I am trying to run a scheme program using MIT-scheme (MIT/GNU Scheme running under GNU/Linux, Release 7.7.90.+ || Microcode 15.1 || Runtime 15.7) and I would like to access the command-line arguments.
I have looked in the documentation but I haven’t found anything specific.
I have tried command-line, but I get an error message:
;Unbound variable: command-line
Do I have to load some library in order to use command-line, or is there some other function for this?
I have managed to find the following solution.
I have created a file
init.scmwith the following definitions:In this way, when the command line option
--argsis found, the functionparse-argument-listis invoked.I have loaded this file into the
mit-schemeinterpreter and saved a world image(
init.com) using the proceduredisk.save.I have then written a shell script (bash) that invokes my main Scheme script as follows:
Finally, in my main script I can access the command line arguments through the variable
I am not sure whether this is the standard / correct way to do this but at least it works.