In the Java source code for Clojure, I have seen:
import clojure.lang.RT;
import clojure.lang.IFn;
RT
seems to stand for "run-time" (although no official source is given in the answer: In the clojure source code, what does RT stand for?)
But what does IFn
stand for?
IFn means Interface Function. Clojure uses the capital "I" prefix for Java interfaces and "A" for Java abstract classes.
See also IFn Javadoc and IFn source
in clojure's terms there is also one more difference between fn
and ifn
:
user> (defn f [x] x)
#'user/f
user> (map fn? [f #(list %) :keyword 'sym {:a 10} #{123} [1 2 3] 10 "asd"])
(true true false false false false false false false)
user> (map ifn? [f #(list %) :keyword 'sym {:a 10} #{123} [1 2 3] 10 "asd"])
(true true true true true true true false false)
so, as you can see fn?
is true for actual functions only, while ifn?
if true for anything, that could be called as a function (like keywords, maps e.t.c)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With