The program is built using Gambit and compiled up into an exe but I'd
like to pass a command line parameter of the filename of more scheme
code to execute at runtime.
Having coded this to read the file contents into a string and then
pass to eval, I realise my mistake which is eval merely executes the
string e.g. (eval "(+ 5 5)") i.e. it returns "(+ 5 5)" instead of 10
which I was hoping.
Is there an easy way to parse a string and turn it into an s-
expression without having to write a complex parser ?
Thanks
Andrew
`read' is the parser you want. You can `read' straight from the file
port, or stream, or whatever it is called nowadays, and I think there
may be a standard way to `read' from a string now, too.
Thanks Jussi,
Works a treat :-
(eval (call-with-input-string "(+ 5 5)" read))