21 lines
671 B
Plaintext
21 lines
671 B
Plaintext
;;;; A mistake in a body a macro spliced is reported where it was written.
|
|
;;;;
|
|
;;;; do-grid takes the body apart and puts it back inside two dotimes, and
|
|
;;;; nothing in it is rewritten on the way. So the (+ mr) below is the very
|
|
;;;; form the author wrote, and the line it is reported on is the one it is
|
|
;;;; written on -- not the line of the do-grid call, which is where every node
|
|
;;;; of an expansion used to land.
|
|
(defmacro do-grid [[r rows c cols] & body]
|
|
`(dotimes [~r ~rows]
|
|
(dotimes [~c ~cols]
|
|
~@body)))
|
|
|
|
(defn main [] i32
|
|
(let [rows 4
|
|
cols 4
|
|
mr 1]
|
|
(do-grid [br rows bc cols]
|
|
(let [v (+ mr)]
|
|
(set v v))))
|
|
0)
|