问题
The source for clojure.core appears to assume the pre-existence of fn*
. Where is this defined? What else is needed for bootstrap (over existing Java types)? How is it all put together?
Maybe this has already been asked? I am having a hard time getting good search results for fn*
.
update: Changed "bootstrap itself" to "bootstrap" in title, because I didn't want to imply Clojure was self-hosting.
回答1:
in src/jvm/clojure/lang/Compiler.java 46 line:
static final Symbol FN = Symbol.intern("fn*");
fn* implement by clojure compiler, as others special form, I guess.
Update: in analyzeSeq method, 6452-6353 line:
if(op.equals(FN))
return FnExpr.parse(context, form, name);
please check out FnExpr class implement code.
来源:https://stackoverflow.com/questions/10767305/what-is-fn-and-how-does-clojure-bootstrap