[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: Newbie cluelessness continued...

William James

7/25/2015 5:58:00 AM

Tim Bradshaw wrote:

> If you want to use basic tools:
>
> (with-open-file (...)
> (loop with r = '()
> for line = (read-line stream nil stream)
> until (eql line stream)
> do (push line r)
> finally (return (nreverse r))))

Gauche Scheme:

(with-input-from-file "junk.txt"
(cut generator-map
values
read-line))

> If you want to write idiomatic LOOP code:
>
> (with-open-file (...)
> (loop for line = (read-line stream nil stream)
> until (eql line stream)
> collect line))

(use file.util)
(file->string-list "junk.txt")

--
The struggle of our time is to concentrate, not to dissipate: to renew our
association with traditional wisdom: to re-establish a vital connection between
the individual and the race. It is, in a word, a struggle against Liberalism.
--- T. S. Elliot