[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: loop macro
- To: Soley@MC.LCS.MIT.EDU
- To: Liz@brillig.umd.edu
- Subject: Re: loop macro
- From: Gregor.pa@Xerox.COM
- Date: Thu, 06 Feb 1986 13:01:00 -0000
- Cc: Gregor.pa@Xerox.COM, common-lisp@SU-AI.ARPA
- In-reply-to: Soley@MC.LCS.MIT.EDU's message of Wed, 5 Feb 86 17:46 EST
;; Return a list of the items in list-of-items
;; which pass the test TEST.
(iterate ((item in list-of-items))
(when (test item)
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.
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