[plt-scheme] using mzscheme like DrScheme
On Sun, 7 Jan 2007, Prabhakar Ragde wrote:
> I'm sorry if this is an utterly basic question, but: as I understand mzscheme
> -r myfile.ss, it will evaluate expressions in myfile.ss but won't print the
> results in the way DrScheme does (when a program in the Definitions window is
> run).
Yes, '-r' turns off the Read-Eval-Print Loop, and you're missing the
'Print' part of the REPL.
> It will, however, print anything which is the result of explicit output
> (display, printf, etc.). Is there any way to get it to behave like
> DrScheme
Here's one way to do what you want:
#############################################################
mithril:~ dyoo$ cat foo.ss
42
(* 3 4)
"forty five"
mithril:~ dyoo$
mithril:~ dyoo$ mzscheme -mve '(with-input-from-file "foo.ss"
read-eval-print-loop)'
> 42
> 12
> "forty five"
#############################################################
That is, we can explicitely call the REPL to run across our source file.