William James
10/1/2015 3:40:00 PM
Rob Warnock wrote:
> where if "form2" is omitted then the variable "var" still *is* updated
> every time through the loop, but by the value of "form1", which is
> 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)))
>
> instead of this:
>
> (with-open-file (s "filename")
> (loop for line = (read-line s nil nil) then (read-line s nil nil)
> while line
> do (process-one-line line)))
Gauche Scheme:
(with-input-from-file "filename"
(lambda () (generator-for-each process-one-line read-line)))
--
It is one of the highest offices of constitutions to protect the rights and the
liberty of the citizen. We may say that if a constitution fails in this, it
fails in all. Under all forms of government the greatest danger to the citizen
is from those who govern. --- The Old Guard, February 1863, p. 31