Hi Tom,

"try" is a special form, and "test" is a function.

Stu

> I know I should not be naming my functions the same thing as ones in
> core but was surprised when I wrote the following
> https://github.com/thattommyhall/tth-SICP/blob/master/1-35.clj
> I have being doing the SICP stuff in clojure and accieently copied
> "try" as the fn name and it did not work, I noticed a colleague chose
> "test" and it did work, but test is in core too so I don't get the
> difference.
> 
> Playing around on the repl I get
> user> (defn try [] ())
> #'user/try
> user> (defn test [] ())
> WARNING: test already refers to: #'clojure.core/test in namespace:
> user, being replaced by: #'user/test
> #'user/test
> user> (try 1)
> 1
> user> (test 1)
> Throws "Wrong number of args (1) passed to: user$test" (as you would
> expect from my defn of test)
> 
> user> (user/try 1)
> and
> user> (user/test 1)
> both
> throw the error.
> 
> 
> Why can test be shadowed and not try? Am I missing something?
> 
> Tom
> 
> -- 
> 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

-- 
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