[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Re: read into lists

William James

6/5/2015 3:59:00 PM

> > Hi
> >
> > how can I read input from the keyboard into a list
>
> Assuming that the keyboard is attached to *standard-input*
>
> (loop with eof = (gensym)
> for thing = (read *standard-input* nil eof)
> until (eq thing eof)
> collect thing)
>
> Mmmmmm, tastes like ALGOL...

Gauche Scheme:

(generator-map values (cut read (standard-input-port)))

Another way:

(port->list read (standard-input-port))

--
He has nothing but kind sentiments for those who would destroy his home and
family.... He is universally tolerant. He is totally unprejudiced. If he has
any principles, he keeps them well concealed.... He is, to the extent of his
abilities, exactly like the next citizen, who, he trusts, is trying to be
exactly like him: a faceless, characterless putty-man.
--- Father Feeney; "Should Hate Be Outlawed?"