I'm not sure I fully understand symbol resolution and the evaluation
strategy of symbol bindings and special forms in Clojure 1.2.

Let's say I bind 'if' (usually being a special form) to a function:

user=> (defn if [x] (* x x))
#'user/if

However, calling 'if' with an unqualified name does not work. Still,
'if' works like a special form:

user=> (if 3)
java.lang.Exception: Too few arguments to if (NO_SOURCE_FILE:74)
user=> (if true 1 2)
1

However, 'if' itself evaluates to the new function on the REPL:

user=> if
#<user$if user$if@118d189>

But I can call the redefined 'if' only with a qualified symbol name

user=> (user/if 3)
9

Why is that? I find it inconsistent to see 'if' evaluating to a
function in the REPL but not in the context of a list; in a list form
I'm forced to use a qualified name to suppress interpretation as a
special form. What is the precise evaluation strategy? (I know, it's
dangerous to redefine special forms. Here, I'm interested in the
evaluation strategy of special forms vs. bound symbols.)

Cheers,

Dominikus

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to