> I can't see where the variables are boxed into objects. Both the loop
> and the let declare them as primitives if they are given primitives.
> Perhaps they are already objects before they reach the inc and dec
> function calls in the recur, but if so, it's a mystery to me why.

Yeah that is interesting. I'm not sure the _why_ of it but I attempted
to narrow it down and it looks like it has something to do with nested
loops and recur. The code below is basically the same thing except the
first one generates auto-boxing warnings while the latter does not.
I'd also like to know why this is.

(set! *warn-on-reflection* true)

;; generates auto-boxing warnings
(defn example [^long x]
  (loop [a x]
    (let [i (loop [k a] k)]
      (if false (recur i) i))))

;; no warnings
(defn example [^long x]
  (loop [a x]
    (let [i (let [k a] k)]
      (if false (recur i) i))))

Also, I couldn't resist giving qsort another attempt. I got a new
laptop and need to break it in somehow :) So here is a rewritten
version based on an example in "Introduction to Algorithms" without
casts.

https://gist.github.com/763139

Allen

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