How can I run a Scheme script and exit? For example, if I have a file named
'myscript.scm` containing:

    (display "Hello!")
    (newline)
    (display (+ (read) 1))

How can I run the file using MIT Scheme?

Contrary to the convention in just about every other programming language
implementation, `mit-scheme myscript.scm` is not valid on the command line.

There have been fairly popular questions of Stack Overflow about this
problem:

*
https://stackoverflow.com/questions/903968/how-do-i-execute-a-scm-script-outside-of-the-repl-with-mit-scheme
*
https://stackoverflow.com/questions/24720112/mit-scheme-run-a-script-and-exit
*
https://stackoverflow.com/questions/39816824/how-do-you-use-mit-gnu-scheme-in-non-repl-mode

Most of the "solutions" involve input redirection ('mit-scheme --quiet <
myscript.scm`), but this method fails when the script uses input procedures
(e.g. read, read-char, read-line. etc.) because the input redirection
causes the input procedures to read from the file rather than prompt the
user for input.

Is there a way to run a Scheme script using MIT Scheme? If so, how?
_______________________________________________
MIT-Scheme-devel mailing list
MIT-Scheme-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/mit-scheme-devel

Reply via email to