You're viewing version 1.2.0 of macroexpand-all. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

macroexpand-all

clojure.walk

  • (macroexpand-all form)
Recursively performs all possible macroexpansions in form.

2 Examples top

  • user=> (use 'clojure.walk)
    user=> (macroexpand-all '(-> c (+ 3) (* 2)))
    (* (+ c 3) 2)
  • user=> (use 'clojure.walk)
    
    ; tryclj.com and lazybot on #clojure get the following wrong
    user=> (let [-> inc] (-> 5)) 
    6
    
    ; Below macroexpansion is supposed to result in equivalent code to the above
    user=> (macroexpand-all '(let [-> inc] (-> 5)))
    (let* [-> inc] 5)
    user=> (let* [-> inc] 5)
    5
    
    ; However, as is clear above, it does not
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/walk.clj:127 top

(defn macroexpand-all
  "Recursively performs all possible macroexpansions in form."
  {:added "1.1"}
  [form]
  (prewalk (fn [x] (if (seq? x) (macroexpand x) x)) form))
Vars in clojure.walk/macroexpand-all: defn fn macroexpand seq?
Used in 0 other vars

Comments top

No comments for macroexpand-all. Log in to add a comment.