Define local macros that are used in the expansion of exprs. The
syntax is the same as for letfn forms.
(defmacro macrolet
"Define local macros that are used in the expansion of exprs. The
syntax is the same as for letfn forms."
[fn-bindings & exprs]
(let [names (map first fn-bindings)
name-map (into {} (map (fn [n] [(list 'quote n) n]) names))
macro-map (eval `(letfn ~fn-bindings ~name-map))]
(binding [macro-fns (merge macro-fns macro-map)
macro-symbols (apply dissoc macro-symbols names)]
`(do ~@(doall (map expand-all exprs))))))
Comments top
No comments for macrolet. Log in to add a comment.