CLIM mail archive

[Prev][Next][Index][Thread]

Re: color definitions




Oops - one of my local macros slipped into my last post:

(defmacro with-collection ((&optional (fn 'collect)) &body body)
  "Within the body each call to (collect x) will collect x in a list.
  The FN argument defaults to COLLECT, but you can rename it if you want.
  Example: (with-collection () (collect 1) (collect (+ 1 1))) => (1 2)"
  ;; Note: in Lucid, nreverse at end is faster than tconc structures.
  (let ((var (gensym "COLLECT")))
    `(let ((,var nil))
      (flet ((,fn (x) (push x ,var)))
	(declare (inline ,fn))
	,@body
	(nreverse ,var)))))



Main Index | Thread Index