[plt-scheme] Dealing with string->symbol
Pierre CHATEL <addicted2 at wanadoo.fr> writes:
> input: "(sin x)"
> output: (eval (list 'lambda '(x) (string->symbol input)))
How about:
(define in "(sin x)")
(let ((in-port (open-input-string in)))
(eval (read in-port)))
or something like:
(require (lib "string.ss"))
(eval-string in)
> but it seems not to work !
> (string->symbol 'a) is giving "a"
^^^^^^^^^^^^^^
symbol->string no?
> but (string->symbol "(sin x)") outputs |(sin x)| ?!
^^^^^^^^^
which is a symbol, not a
list containing a primitive, and a variable.
HTH,
--Francisco