Skip to content

Instantly share code, notes, and snippets.

@zcaudate
Created June 29, 2012 22:06
Show Gist options
  • Save zcaudate/3020937 to your computer and use it in GitHub Desktop.
Save zcaudate/3020937 to your computer and use it in GitHub Desktop.
do-until
(defmacro do-until [& clauses]
(when clauses
(list
`when (first clauses)
(if (next clauses)
(second clauses)
(throw (IllegalArgumentException.
"do-until requires an even number of forms")))
(cons 'do-until (nnext clauses)))))
(do-until
true (println "Line 1")
nil (println "Line 2")
true (println "Line 3"))
; => "Line 1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment