On 19 June 2010 23:51, Mike Meyer <mwm-keyword-googlegroups.620...@mired.org> wrote: > In any case, I don't think 10% is enough gain to justify narrowing the > range for which naive programs are correct. An order of magnitude > would be. A factor of two is a maybe.
QFT! Have a look at this: (defn fact [n] (loop [n n r 1] (if (zero? n) r (recur (dec n) (* r n))))) This doesn't compile. To make it compile, the initial value of r has to be given as (num 1) *or* the initial binding of the "inner" n has to be given as (long n). Changing the ops to *' and dec' rules out the latter option, but the (num ...) hint on r is still required. Not surprisingly having r start off with (Long. 1) solves makes this compile too. The summary is that I'm finding it impossible to write a standard tail-recursive factorial function without type hints on my literals. I suppose I can guess what the reason is by now, but I find it unreasonably confusing. Not sure to which degree this can be ironed out if boxing were to remain an opt-in rather than -out...? Oh, just in case votes on this are of interest, I like the idea of loop' for fast-by-default looping. Sincerely, Michał -- 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