Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure by

Hello friends!
Why function name "fn*" is incorrect?

user=> (defn fnn* [x] (+ x 1))


user=> (fnn* 4)

user=> (defn fn* [x] (+ x 1))


user=> (fn 4)
Syntax error (ClassCastException) compiling fn
at (REPL:1:1).
class java.lang.Long cannot be cast to class clojure.lang.ISeq (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.ISeq is in unnamed module of loader 'bootstrap')


1 Answer

+5 votes
selected by
Best answer

Because fn*, along with a few other symbols, is a special symbol. I think it's called a compiler intrinsic but don't quote me on that.
Such symbols are handled directly by the compiler when it sees them in the right position. So when the compiler sees (fn* ...) it thinks that it's a low-level definition of a function - even though you have created your own definition of fn*.

Thank you!