[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

re: Lisp newbie, data structures, parsing.

William James

3/24/2015 2:32:00 AM

Rob Warnock wrote:

> re-evaluated every time though the loop. That's why the common idiom
> for stepping through the lines of a file is this:
>
> (with-open-file (s "filename")
> (loop for line = (read-line s nil nil)
> while line
> do (process-one-line line)))

Gauche Scheme:

(use srfi-42) ; do-ec

(call-with-input-file "filename"
(lambda (port)
(do-ec (: line port read-line)
(process-one-line line))))


Also works under Racket, with this change:

(require srfi/42) ; do-ec