Thanks The use of (int ...) works, avoiding the dispatch, but it has to be used everywhere there is a variable or literal. Starts getting very ugly and unreadable as expressions get longer. Is there any way to indicate an "int" or "double" literal short of (int 2). Here is the modified function:
(defn fib [a] (let [v (int a)] (if (< v (int 2)) v (+ (fib (- v (int 1))) (fib (- v (int 2))))))) I suspect that on recursion a will become an object again and will then need to be downcasted again as well. Would be nice to be able to do: (defn fib [#^int v] (if (< v 2) v (+ (fib (- v 1)) (fib (- v 2))))) and just have it "work". If v is known to be an int, then one should be able to deduce in this case that the literals should be as well. Short of that, some concise decoration on literals like #2 or something ... -- 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