In my last post, I’ve introduced the defmacro! macro, which is just like defmacro, except that it guarantees that all of the arguments are evaluated once only. However, in contrast to Doug Hoyte’s defmacro! he introduced in Let over Lambda, my macro expanded into a normal defmacro form that expanded into a form where all [...]
Posts Tagged ‘macros’
When programming macros, it’s often desired to have its arguments evaluated only once. Let’s have a look at a simple example: user> (defmacro square [x] `(* ~x ~x)) #’user/square user> (square 5) 25 At a first glance, it seems to work. But see what happens here: user> (def c (let [a (atom 4)] #(swap! a [...]