Hi,

Am 15.11.2009 um 14:51 schrieb Angel Java Lopez:

2) The cond macro is defined:

(defmacro cond
  "Takes a set of test/expr pairs. It evaluates each test one at a
  time.  If a test returns logical true, cond evaluates and returns
  the value of the corresponding expr and doesn't evaluate any of the
  other tests or exprs. (cond) returns nil."
  [& clauses]
    (when clauses
      (list 'if (first clauses)
            (if (next clauses)
                (second clauses)
                (throw (IllegalArgumentException.
                         "cond requires an even number of forms")))
            (cons 'clojure.core/cond (next (next clauses))))))

Why the need of add the full namespace name in the last cons?

If you don't qualify the recursive call, you'll get in trouble if a user namespace defines its own cond. clojure.core/cond will then call the original cond, but the expansion would call the user defined one. And suddenly you are name capture hell. Fully qualifying the recursive call is avoiding this issue.

Note, the syntax-quote is not yet available at that point of core.clj!

Sincerely
Meikel

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to