This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

conditional loop

3 posts · 2082 views

How we can have a conditional loop in lisp ?
I know that we can dotimes for having loop but I want to have a condition : until var is not equal to "test" continue and when it equals to "test" do not continue.

Re: conditional loop

(defmacro until (test &body body)
  `(do ()
       (,test)
     ,@body))
;; and its companion
(defmacro while (test &body body)
  `(until (not ,test)
     ,@body))