[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What?



In article <bruce-ED98BE.09351212082002@copper.ipg.tsnz.net>,
 Bruce Hoult <bruce@hoult.org> wrote:

> In article <874re161xr.fsf@meo-dipt.andreas.org>,
>  Andreas Bogk <andreas@andreas.org> wrote:
> 
> > > (defmethod read-lines ((stream stream))
> > >   (loop for line = (read-line stream nil nil)
> > >         while line collect line))
> > 
> > Hehe, loop is quite a nifty macro :).
> 
> The CL "loop" macro is one of the reasons that I think the decision to 
> go with infix syntax for Dylan is the correct one.  When you want to 
> create complex syntax with many options, pure S-expressions just don't 
> cut it and you need actual *syntax*.

LOOP just happens to be standardized - it is often
considered ugly and alien to Common Lisp. But its there.

A, IMHO, much better iteration package is
ITERATE from Jonathan Amsterdam. The above code
then looks:

(defmethod read-lines ((stream stream))
  (iter (for line = (read-line stream nil nil))
        (while line)
        (collect line)))

Hehe.

http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/it
er/iterate/0.html