[iterate-devel] if-first-iteration

Attila Lendvai attila.lendvai at gmail.com
Sat Jan 7 01:34:42 UTC 2006


hi!

thanks for iterate, it's coool! :)

i'm new to lisp, and while hacking i was missing if-first-iteration
which is enclosed in the mail. sorry for a simple paste, but learning
arch seems to be a bigger task then writing the actual feature. it was
fun looking at a complex macro lib.

bear with me if the code is naive, i'm way too new to lisp for patches
like this.

i think the clause name tells it all, feel free to include.

happy coding,

- attila lendvai


(def-special-clause IF-FIRST-ITERATION (then &optional else)
  (setf then (list (walk-expr then)))
  (setf else (list (walk-expr else)))
  (let ((var (make-var-and-binding 'first-iteration t :type 'boolean)))
    (return-code :body (list (if else
				 `(cond
				   (,var , at then)
				   (t , at else))
				 `(when ,var
				   , at then)))
		 :step (list `(setf ,var nil)))))



More information about the iterate-devel mailing list