From: ········@ucs.orst.edu
Subject: Help! Convert string to list
Date: 
Message-ID: <38274738.F7D04325@ucs.orst.edu>
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
From: Barry Margolin
Subject: Re: Help! Convert string to list
Date: 
Message-ID: <8RIV3.98$u3.2426@burlma1-snr2>
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.