• (apply-macro macro & args)
This is evil. Don't ever use it. It makes a macro behave like a
function. Seriously, how messed up is that?

Evaluates all args, then uses them as arguments to the macro as with
apply.

(def things [true true false])
(apply-macro and things)
;; Expands to: (and true true false)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/apply_macro.clj:34 top

(defmacro apply-macro
  "This is evil.  Don't ever use it.  It makes a macro behave like a
  function.  Seriously, how messed up is that?

  Evaluates all args, then uses them as arguments to the macro as with
  apply.

  (def things [true true false])
  (apply-macro and things)
  ;; Expands to:  (and true true false)"
  [macro & args]
  (cons macro (spread (map eval args))))
Vars in clojure.contrib.apply-macro/apply-macro: cons defmacro eval map
Used in 0 other vars

Comments top

No comments for apply-macro. Log in to add a comment.