[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: What are parentheses for?

William James

5/24/2015 11:52:00 AM

David Bakhash wrote:

> > concise and meaningful, but using recursion to read
> > records out of a simple sequential file like Slade's Lisp book?
> > Keep what is simple, simple...like Perl:
>
> > while ($line = <infile>) {
> > print $line;
> > }
>
> CL makes this particular example quite easy too:
>
> ;; unchecked...
> (with-open-file (file "file.txt")
> (loop for line = (read-line file nil)
> while line
> do (print line)))

Gauche Scheme:

(with-input-from-file "file.txt"
(cut generator-for-each print read-line))

--
How does the Swedish political elite respond to their largest cities breaking
down? By pretending there is no problem. The media elite shares the same
contempt for and fear of the common people, and has largely played along.
fjordman.blogspot.ca/2005/05/is-swedish-democracy-collapsing.html
1 Answer

William James

12/2/2015 12:31:00 AM

0

WJ wrote:

> David Bakhash wrote:
>
> > > concise and meaningful, but using recursion to read
> > > records out of a simple sequential file like Slade's Lisp book?
> > > Keep what is simple, simple...like Perl:
> >
> > > while ($line = <infile>) {
> > > print $line;
> > > }
> >
> > CL makes this particular example quite easy too:
> >
> > ;; unchecked...
> > (with-open-file (file "file.txt")
> > (loop for line = (read-line file nil)
> > while line
> > do (print line)))

Ocaml:

let chan = open_in "args.ml" in
try
while true do print_endline (input_line chan) done
with End_of_file -> close_in chan ;;

--
How does the Swedish political elite respond to their largest cities breaking
down? By pretending there is no problem. The media elite shares the same
contempt for and fear of the common people, and has largely played along.
fjordman.blogspot.ca/2005/05/is-swedish-democracy-collapsing.html