(defmacro do-grid [[r rows c cols] & body] ...) — positional names, a [ ] pattern wherever an argument is a vector, and & for the tail. The reading of the list lives in Expand, below both sides that need it: Parse turns it into the bindings a macro body opens with, and Macro checks a call against the same reading before expanding it, so arity and shape are refused with the call's own location rather than with the Loc.from_macro stamp every node of an expansion carries. The breaking half: [args] used to bind the whole argument list and now binds the first argument. The whole list is [& args], and every defmacro in the tree — prelude, vendor, tests, the elisp fixtures — was migrated to it. One grammar, not a legacy mode.
10 lines
384 B
Plaintext
10 lines
384 B
Plaintext
;;;; A [ ] pattern meeting an argument that is not a vector. The pattern says
|
|
;;;; what the call has to look like, so this is refused where the argument is
|
|
;;;; written rather than inside an expansion that read (at ... 0) of a Sym.
|
|
(defmacro do-grid [[r rows c cols] & body]
|
|
`(dotimes [~r ~rows] (dotimes [~c ~cols] ~@body)))
|
|
|
|
(defn main [] i32
|
|
(do-grid 7 (println "never"))
|
|
0)
|