Plaster

text
(defmacro for ((index start end) &body body) "Iterates body between start and end inclusive. Returns the last evaluated form in the body." (labels ((replace-symbol (from to list) ; I dunno how to dispose of this. (cond ((eql list from) to) ((atom list) list) ((null list) nil) (t (cons (replace-symbol from to (car list)) (replace-symbol from to (cdr list))))))) (alexandria:once-only (start end) ; Not gonna bother with being hygenic on my own. (alexandria:with-gensyms (counter^ out^ start-tag^) ; Names ending with ^ hold gensymed symbols. Rename at your own leisure. `(let ((,counter^ ,start) ,out^) (tagbody ,start-tag^ (setf ,out^ (progn ,@(replace-symbol index counter^ body))) (when (< ,counter^ ,end) (incf ,counter^) (go ,start-tag^))) ,out^)))))

Annotations