Skip to content

Comment on The Weird and Wonderful Characters of Clojure

Comments

I don't understand the difference between fn and fn* . After some brief experimenting in the REPL, they seem to behave exactly the same, the only difference being that fn* is what comes out of macro expanding the #( macro

Is there a reason that the #( macro doesn't expand to plain old fn?

fn is a macro that knows how to apply destructuring rules, fn* is a primitive read by the clojure compiler and cannot apply destructuring rules.

https://github.com/clojure/clojure/blob/master/src/clj/cloju...

fn itself is a macro, fn* is a symbol defined at the compiler level:

    static final Symbol FN = Symbol.intern("fn*");
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.