Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mit-scheme -- run a script and exit

Tags:

mit-scheme

I want to evaluate a script from makefile and exit, like this

mit-scheme --load "fact.scm"

However, after it evaluates the file, it does not exit, and the repl appears; if I try the (exit) primitive, it asks for confirmation y/n. Is it possible to solve this ?

like image 578
alinsoar Avatar asked Jul 13 '14 06:07

alinsoar


People also ask

How do I run a scheme file?

To run Scheme from within Emacs, start emacs, and then use the command M-x run-scheme. (That is, press the ESC key, then x then at the prompt run-scheme ). This will create a buffer called *scheme*, which will be in "inferior scheme mode".

How do I run a scheme code?

The easiest way to write Scheme code is to use an editor like Emacs and execute run-scheme . After that you can send any s-expression with Ctrl-x Ctrl-e from the editor to the interpreter. Emacs shows the result in the REPL window.


1 Answers

Just let our command close stdin of the mit-scheme process automatically, e.g.

echo | mit-scheme --load sample.scm

We can expand it to a script function; here's my unskilled implementation:

function mschm () {
   IFS=""
   for arg in $@
       do
           echo | mit-scheme --load $arg
       done
}
like image 118
Charlie Forthmount Avatar answered Nov 15 '22 06:11

Charlie Forthmount