Is there a way to create a function definition if you have the body as a string?
Eg
(set 'body "(println x) (exit)")
(define (func) body)
Hey cormullion,
I don't know exactly what you're driving at, but does this help?
(define (string2func str func-name)
(eval-string (string "(define (" func-name ") " str ")")))
(set 'x 42)
(set 'body "(println "Hello") (println x)")
> (string2func body 'func)
(lambda () (println "Hello") (println x))
> (func)
Hello
42
42
Ah, yes - I was thinking about list and string. I must have forgotten that eval-string doesn't always run immediately...
Thanks! Glad you haven't gone over to Arc completely, Ricky!
Quote from: "cormullion"
Glad you haven't gone over to Arc completely, Ricky!
:-)