On 9 March 2010 04:03, Jonathan Shore <jonathan.sh...@gmail.com> wrote: > (defn fib [#^Integer a] > (if (< a 2) > a > (+ (fib (- a 1)) (fib (- a 2))))) > I'm just learning, so I may have overlooked something that mitigates or > otherwise avoids dispatch.
You might want to experiment with something like (defn fib [a] (let [ia (int a)] ..........)) I know that seems a little weird but anything passed into or out of a function gets boxed to an object type. (int a) coerces to a primitive int which for some operations has much better performance. Regards, Tim. -- 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