symbol-macrolet

clojure.contrib.macro-utils

  • (symbol-macrolet symbol-bindings & exprs)
Define local symbol macros that are used in the expansion of exprs.
The syntax is the same as for let forms.

1 Example top

  • user> (symbol-macrolet [hi (do (println "Howdy") 1)] (+ hi 2))
     
    Howdy
    3
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/macro_utils.clj:212 top

(defmacro symbol-macrolet
  "Define local symbol macros that are used in the expansion of exprs.
   The syntax is the same as for let forms."
  [symbol-bindings & exprs]
  (let [symbol-map (into {} (map vec (partition 2 symbol-bindings)))
	names      (keys symbol-map)]
    (binding [macro-fns     (apply dissoc macro-fns names)
	      macro-symbols (merge macro-symbols symbol-map)]
      `(do ~@(doall (map expand-all exprs))))))
Vars in clojure.contrib.macro-utils/symbol-macrolet: binding defmacro doall let map concat list seq
Used in 0 other vars

Comments top

No comments for symbol-macrolet. Log in to add a comment.