[plt-scheme] PLT MzScheme - How to use "--main"?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Dec 21 07:16:39 EST 2007

At Fri, 21 Dec 2007 09:30:52 -0000, Márcio Faustino wrote:
> Can someone please explain me how to use MzScheme to run a Scheme program  
> with the "--main" option?
> For example, I have this program:
> (define (main)
>    (format "test"))
> 
> When I run it like this "mzscheme test.scm --main", I was expecting it to  
> print "test", but it doesn't.
> Am I missing something?

`main' is called only for its side-effects, so you'd need something
like

  (define (main)
    (display "test")
    (newline))


But `--main' in v3.99 really should print the result of the call (via
`current-print'), in the same way that `-e' results are now printed in
v3.99. I'll make that change.

Matthew



Posted on the users mailing list.