Plaster
New
List
Login
common-lisp
default
anonymous
2021.09.13 18:57:11
(defmacro loop-and-then (escape-form &body body) "Loop infinitely. Call ESCAPE to stop loop-and-then and execute ESCAPE-FORM." `(block done (flet ((escape () (return-from done ,escape-form))) (loop ,@body)))) (let ((n 0)) (loop-and-then (print "Wheee") (when (= n 5) (escape)) (print (incf n)))) ==> 1 2 3 4 5 "Wheee"
Raw
Annotate
Repaste
Edit