Want more features on Pastebin? Sign Up, it's FREE!
Guest

quotes

By: a guest on Oct 9th, 2012  |  syntax: Clojure  |  size: 0.32 KB  |  views: 3  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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)))
clone this paste RAW Paste Data