[comp.sys.xerox] CLLOOP in Lyric

SCHMIDT@SUMEX-AIM.STANFORD.EDU (Christopher Schmidt) (11/17/87)

	In [SUMEX-AIM.Stanford.edu]<LISPUSERS.LYRIC> I've posted
CLLOOP.LISP and CLLOOP.DFASL.
	This is Glenn Burke's Common Lisp LOOP macro derived from the
NIL implementation and announced on the Common-Lisp DL several months ago.
	To compile it, all I had to do was remove the formfeeds.
	LOOP is somewhat similar to Interlisp's built-in i.s.oprs.

Eg. (LOOP with PRIMES for N from 2 to 30
	       when (LOOP for P in PRIMES never (EVENP N P))
	       collect (PROGN (PUSH N PRIMES) N))

is equivalent to Interlisp's

    (bind PRIMES for N from 2 to 30
	  when (for P in PRIMES never (EVENP N P))
	  collect (PUSH N PRIMES) N)

[Yes, I know that in Interlisp you could triple the speed with

    (for N from 2 to 30
	 when (for P in $$VAL never (EVENP N P))
	 collect N)      ]

Notes: a. (bind A B _ 2 --) == (LOOP with A and B = 2 --)
       b. (LOOP:DEFINE-LOOP-MACRO :FOR) or (LOOP:DEFINE-LOOP-MACRO :WITH) lets
you do (:with A :for I :below 6 :collect I); i.e. makes :WITH into a macro.
       c. (:for I to 6) starts at 0; (IL:|for| I IL:|to| 6) starts at 1.
       d. IL:|join| == nconc

	This is the first of the Common Lisp loop packages I've tried out.
Others may be an improvement, so don't take my word for it that this is
the one you should be using.  I'll try SLOOP next, which is said to share
Interlisp's virtue of extensibility.
--Christopher
-------