[plt-scheme] String -> listof symbols

From: David Yrueta (dyrueta at gmail.com)
Date: Mon May 17 13:56:45 EDT 2010

Thank you!

On Mon, May 17, 2010 at 10:42 AM, Danny Yoo <dyoo at cs.wpi.edu> wrote:

> > Is there an easy way to convert a string like this -- "(a or (b and c))"
> --
> >  to a list-of-symbols equivalent to '(a or (b and c)) ?
> > (string->symbol "(a or (b and c))" returns '|(a or (b and c))|" .
>
> You can use read, which knows how to consume the content of an input
> port,  in combination with open-input-string, which knows how to turn
> a string into an input port.
>
>
> http://docs.plt-scheme.org/reference/Reading.html?q=read#(def._((quote._~23~25kernel)._read))
>
>
> http://docs.plt-scheme.org/reference/stringport.html?q=open-input-string#(def._((quote._~23~25kernel)._open-input-string))
>
>
>
> > What do
> > the the vertical lines which book-end the output value signify?
>
> The default writer is introducing those bars as a way of saying "this
> is a symbol, but there's enough funny characters that I'll delimit it
> for you."  The gory details on when this happens are in the section:
>
>
> http://docs.plt-scheme.org/reference/printing.html?q=writer&q=open-input-string
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100517/5044ac84/attachment.html>

Posted on the users mailing list.