Checked out the new prim branch to repeat some tests.

user=> (defn ^:static fib ^long [^long n]
  (if (<= n 1)
    1
    (+ (fib (dec n)) (fib (- n 2)))))
#'user/fib
user=> (time (fib 38))
"Elapsed time: 4383.127343 msecs"
63245986

That's certainly not what I expected....


user=> (defn fact [n] (loop [n n r 1] (if (zero? n) 1 (recur (dec' n)
(*' r n)))))
#'user/fact
user=> (fact 40)
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to
java.lang.Number (NO_SOURCE_FILE:7)


Neither is this.  According to the docs "long-and-smaller integers
promote in all cases, even when given integer primitives" with the
prime ops.

Something I did wrong?

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