Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (24 sloc) 764 Bytes
; argument capture bug was caught by the clojure compiler :)
(defmacro our-for [[var start stop] & body]
`(loop [~var ~start limit ~stop]
(when (< ~var limit) (recur (inc ~var) limit))))
; clojure accepted the debugged version:
(defmacro our-for [[var start stop] & body]
`(loop [~var ~start limit# ~stop]
(when (< ~var limit#) (recur (inc ~var) limit#))))
(our-for [x 1 5] (print x))
(our-for [limit 1 5] (print limit))
(let [limit 5]
(our-for [i 1 10]
(when (> i limit) (print i))))
; 9.2... This macro changes w which it has no unique owership of.
; Poor form to cause side effects like this.
(def w nil)
(defmacro gripe [warning]
(def w (cons w (list ~warning)))
(do (gripe "sample < 2")