[plt-scheme] mzscheme scripts

From: Jacob Matthews (jacobm at cs.uchicago.edu)
Date: Tue Apr 3 10:04:49 EDT 2007

You were very close:

;; -----  in file "prog.ss"
#!/path/to/plt/bin/mzscheme -r
(load "test.ss")
(jump-up-and-down 12)
(swing-side-to-side 37)

;; ------ in file "test.ss"
(define (jump-up-and-down n)
  (printf "I'm jumping up and down ~a times\n" n))

(define (swing-side-to-side n)
  (printf "I'm swinging side to side ~a times\n" n))

;; ------ at the command line:
$ ./prog.ss
I'm jumping up and down 12 times
I'm swinging side to side 37 times
$
;; ---

-jacob

On 4/3/07, Tom Sgouros <tomfool at as220.org> wrote:
>
> Hi:
>
> Is there a way to use mzscheme as the interpreter for a shell script in
> a single file?  I imagine something like this:
>
>   #!/usr/bin/mzscheme
>   (load "test.ss")
>   (jump-up-and-down 12)
>   (swing-side-to-side 37)
>
> Or like this:
>
>   /usr/bin/mzscheme < test.ss
>
> Or:
>
>   /usr/bin/mzscheme <<HERE
>   (load "test.ss")
>   (jump-up-and-down 12)
>   (swing-side-to-side 37)
>   HERE
>
> But none of these work.  I've tried a bunch of different run-time
> options, but haven't found the magic combination, if there is one.  Of
> course you can just do mzscheme -r file, but I'd like to get it all into
> a single file.  What's the best way to do this?
>
> Many thanks,
>
>  -tom
>
> --
>  ------------------------
>  tomfool at as220 dot org
>  http://sgouros.com
>  http://whatcheer.net
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.