Subject: Re: How to read a Scheme program?????
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1995/06/15
Newsgroups: comp.lang.scheme
Message-ID: <3ro9t2$ems@tokyo.engr.sgi.com>
Ji Wang <jiwang@tucson.princeton.edu> wrote:
+---------------
| Hi, I am a beginner of Scheme.  I can use vi to write a program in Scheme,
| but I cannot read it in... I just cannot type the program each time.
+---------------

As someone else said, (load "filename") reads/executes a file.
But here's a further convenience for us non-Emacs users:

	(define e
	  (let ((current-working-file "tmp.scm"))
	    (lambda x
		(if (not (null? x))
		    (set! current-working-file (car x)))
		(ed current-working-file)
		(load current-working-file))))

(e "foo.scm") edits the file foo.scm, and then loads/executes it.

(e) by itself edits the most recent file explicitly named, or
tmp.scm if no file has ever been explicitly named.


-Rob

p.s. If you're not using "SCM", here's some code for "ed":

	(define (ed fname)
	   (let ((editor (getenv "EDITOR")))
	     (if (not editor) (set! editor "/usr/bin/vi")) ; or other default
	     (system (string-append editor " " fname))))

-----
Rob Warnock, MS-9U/510		rpw3@sgi.com
Silicon Graphics, Inc.		Phone: 415-390-1673
2011 N. Shoreline Blvd.		FAX:   415-967-8496
Mountain View, CA  94043	PP-ASEL-IA