From: Alberto Riva
Subject: Re: Read-from-string
Date: 
Message-ID: <gjliat$641q$1@usenet.osg.ufl.edu>
Francogrex wrote on 01/02/2009 11:20 AM:
> When I do this:
> (list (read-from-string "lala tata bobo"))
> the output is: (LALA)
> 
> but I want the output to be: (lala tata bobo), a list of symbols. How
> can this be done. Thanks.

(read-from-string (concatenate 'string "(" "lala tata bobo" ")"))

Alberto
From: Pascal J. Bourguignon
Subject: Re: Read-from-string
Date: 
Message-ID: <87d4f5k2w7.fsf@informatimago.com>
Alberto Riva <·····@nospam.ufl.edu> writes:

> Francogrex wrote on 01/02/2009 11:20 AM:
>> When I do this:
>> (list (read-from-string "lala tata bobo"))
>> the output is: (LALA)
>>
>> but I want the output to be: (lala tata bobo), a list of symbols. How
>> can this be done. Thanks.
>
> (read-from-string (concatenate 'string "(" "lala tata bobo" ")"))

But if the string is big, you copy a lot.

(let ((data "lala tata bobo"))
  (with-input-from-string (lpar "(")
    (with-input-from-string (inside data)
      (with-input-from-string (rpar ")")                
        (let ((input (MAKE-CONCATENATED-STREAM lpar inside rpar)))
          (read input))))))

(let ((data "lala tata bobo"))
  (with-input-from-string (input data)
    (loop :for item = (read input nil input) :until (eql item input) :collect item)))

-- 
__Pascal Bourguignon__