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

Re: loop macro

        ;; Return a list of the items in list-of-items 
        ;; which pass the test TEST.
        (iterate ((item in list-of-items))
          (when (test item)
            (collect item)))

 From Soley@MC.LCS.MIT.EDU

    Parens do not a Lisp code make.  This particular example, for instance,
    isn't any "lispier" than the equivalent LOOP construction; the
    expression "(collect item)" is CERTAINLY not a call to some new function
    COLLECT, is it?

This call to COLLECT is exactly what Guy said it was, a use of a local
macro defined by a macrolet which iterate wraps around its body.

 From Liz@brillig.umd.edu

    I once worked with a looping macro that looked like that -- with
    lots of nested parens.  The main problem with it is that, when you
    look at the code, you tend to think that the (when ...) up there
    is a function call rather than part of some loop.

Yes, the point is that the WHEN up there is a call to the global macro
WHEN.  I think that is nicer than having some special syntax in the
iteration macro that implements the same functionality WHEN already