SHARE
TWEET

quotes

a guest Oct 9th, 2012 9 Never
  1. (defmacro binding-test
  2.   [test body & remainder]
  3.   `(let [~'testVar ~test ~'bodyVar ~body] ~@remainder))
  4.  
  5. (defmacro do-while
  6.   [test & body]
  7.   (binding-test test body
  8.     (quote
  9.       loop []
  10.       bodyVar
  11.       (when testVar
  12.         (recur)))))
  13.  
  14. (def y 4)
  15. (do-while (> y 0)
  16.   (println y)
  17.   (def y (dec y)))
RAW Paste Data
Top