Hi,
I need a simple way to convert a string to a list for a program I am
working on.
(create-list "1 2 3 4 5 #my-func")
should return (1 2 3 4 5 #my-func)
Please help!
Thanks
In article <·················@ucs.orst.edu>, <········@ucs.orst.edu> wrote:
>Hi,
>
>I need a simple way to convert a string to a list for a program I am
>working on.
>(create-list "1 2 3 4 5 #my-func")
>should return (1 2 3 4 5 #my-func)
(defun create-list (string)
(read-from-string (concatenate 'string "(" string ")")))
However, I'm not sure what you expect #my-func to be. # is a special macro
character in Common Lisp and many other Lisp dialects. If you want that to
be read in as a symbol whose name is "#MYFUNC", you'll need to make a
custom readtable that changes the syntax of #\# to a constituent rather
than a macro character.
--
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.