>> So a minor annoyance of mine is that (doc <any special form>) throws a
>> stack trace:
>> I'd like to fix this so that (doc) can be used on special forms, or at
>> least doesn't throw a stack trace.
>
>> The following works, but I'm not sure it's a good idea:
>> (def #^{:doc "evalutes test, then evalutes and yields then, or
>> evalutes else" :arglists '(if test then else)} if nil)
>
> > Then (doc if) works, but then this is weird:
> > =>(def if nil)
> > nil
> > =>(def bar nil)
> > nil
> > =>(= bar if)
> > true
>
> > Thoughts?
>
> That's right -- nil is equal to nil (no null pointers, thankfully!)
>
> (= nil nil) => true
>
> - Chas
I understand that (= if bar) is supposed to work. I was pointing out
that it is weird because one of my symbols has the same name as a
special form . If you def a symbol with the same name as a special
form, it acts like a symbol, up until you begin a sequence with it:
user=> (def bar print)
#'user/bar
user=> (def if print)
#'user/if
user=> (bar "hello")
hellonil
user=> (if "hello")
java.lang.Exception: Too few arguments to if
clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:4: Too few
arguments to if
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3759)
at clojure.lang.Compiler.analyze(Compiler.java:3614)
at clojure.lang.Compiler.analyze(Compiler.java:3589)
at clojure.lang.Compiler.eval(Compiler.java:3779)
at clojure.lang.Repl.main(Repl.java:75)
--Allen