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:
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?