🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.xerox
Article #361

CLLOOP in Lyric

#361
From: Christopher Schmidt
Date: Tue, 17 Nov 1987 06:41
36 lines
1989 bytes
	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
-------
Technical Details
Message-ID: <12351249714.24.SCHMIDT@SUMEX-AIM.STANFORD.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!elroy!cit-vax!ucla-cs!zen!ucbvax!SUMEX-AIM.STANFORD.EDU!SCHMIDT

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!elroy!cit-vax!ucla-cs!zen!ucbvax!SUMEX-AIM.STANFORD.EDU!SCHMIDT
From: SCHMIDT@SUMEX-AIM.STANFORD.EDU (Christopher Schmidt)
Newsgroups: comp.sys.xerox
Subject: CLLOOP in Lyric
Message-ID: <12351249714.24.SCHMIDT@SUMEX-AIM.STANFORD.EDU>
Date: Tue, 17-Nov-87 01:41:03 EST
Article-I.D.: SUMEX-AI.12351249714.24.SCHMIDT
Posted: Tue Nov 17 01:41:03 1987
Date-Received: Thu, 19-Nov-87 07:03:27 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 36