Path: utzoo!mnetor!uunet!husc6!cmcl2!beta!dzzr From: dzzr@beta.UUCP (Douglas J Roberts) Newsgroups: comp.lang.lisp Subject: Re: Looking for Common Lisp iteration macros Message-ID: <16786@beta.UUCP> Date: 21 Mar 88 21:10:23 GMT References: <23319@ucbvax.BERKELEY.EDU> Organization: Los Alamos Natl Lab, Los Alamos, N.M. Lines: 32 Summary: Here's one In article <23319@ucbvax.BERKELEY.EDU>, mkent@dewey.soe.berkeley.edu (Marty Kent) writes: > I'm trying to find some reasonable iteration macros for common lisp. My > recent experience is with Interlisp, and I've become extremely fond of > the very general iteration constructs there (which are not, however, > implemented as macros). For-loops, while-loops, etc. are all desireable. > Please send to me rather than to the net; I'll post a summary to the net > if I get requests to do so... Here's one that was bandied about the net a "while" ago. ;;; -*- Mode: LISP; Syntax: Common-lisp; Package: K -*- (defmacro while (test-form &body body) "This macro evaluates test-form, and if the result is non-nil all subsequent forms will be iteratively evaluated until test-form evaluates to nil. Example: (while (test-form) (form1) (form2) . . . )" `(do () ((not ,test-form)) ,@body)) ---------------------------------------------------- Doug Roberts Los Alamos national Laborotory dzzr@lanl.gov