On Jun 18, 2010, at 22:52 , Rich Hickey wrote:

> Thanks to all for the feedback, keep it coming!

Okay you asked for it :P

to quote from the IRC:

mmarczyk:
also, (defn fact [n] (loop [n n r 1] (if (zero? n) 1 (recur (dec n) (* r n))))) 
throws on (fact 40) -- that's with *, not *'

and it trhows: java.lang.IllegalArgumentException: Value out of range for long: 
158905670470170624000


and as you explained it is because 1 is a primitive instead of a Number. This 
is quite frankly not the best behavior in my eyes. Not only is the error 
message overly cryptic, and if you hadn't explained us what went wrong we 
likely taken hours to figure it out, but also the behavior is very very 
strange. This again is not 'it just works' but 'it works most of the time and 
if not has horrible painful and unpredictable consequences'.

I start this again, I know, but imagine someone starting to code in clojure and 
reaching this point, they will be super frustrated, toss the language in the 
next corner and start crying for the next full moon. Don't get me wrong it is 
not a reason to drop the language, god (or whatever you believe in) forbid, but 
it is very well a reason not to learn the language. I say it frankly if that 
would have been one of my first experiences, before I learned what joy and 
beauty clojure can be, I'd had turned without a second thought - and taking 
this is a very simple example many newcomers might actually write, this is a 
not unlikely scenario.

Regards,
Heinz

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