[plt-scheme] Dealing with string->symbol

From: Francisco Solsona (solsona at acm.org)
Date: Wed Aug 14 12:04:19 EDT 2002

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.


Posted on the users mailing list.