If you're going to give example of what the current branch is like, at least
write the code how a primitive Clojurian would write it:

(let [n (long 9223372036854775810)]
  (* (/ n 3) 3))
; Value out of range for long: 9223372036854775810

(let [n (long 9223372036854775810)]
  (* (/ n 2) 2))
; Value out of range for long: 9223372036854775810

(let [n 9223372036854775810
      x (long (/ n 4))]
  (-> x (+ x) (+ x) (+ x)))
; integer overflow

No need to continue, a primitive Clojurian would have known that number is
too large to fit into a long anyway.

You also fail to show that in the equals branch if you are an auto-promoting
Clojurian using the right operators everything is just dandy:

(def n 9223372036854775810)
(*' (/ n 3) 3)
(*' (/ n 2) 2)
(def x (/ n 4))
(+' x x x x)
(+' (+' x x) (+' x x))

No errors, except for the case of range which internally uses +. Clearly a
range' is in order. This behavior should satisfy any Eulerian enthusiast.

Which brings us to your final point. Is the divide between primitive and
boxed numbers something to worry about? Rich will be the final say of that.

Yet consider this, If I'm writing OpenGL code in Penumbra I will have quite
a bit of code that amounts to the following:

; 630 msecs
(dotimes [_ 10]
  (time
   (dotimes [_ 1000000000]
     (+ 1 2))))

Yes. With Rich's primitive work we can get to *1 billion arithmetic
operations* in < 2/3 of a second on commodity hardware.

; 10662.927 msecs
(dotimes [_ 10]
  (time
   (dotimes [_ 1000000000]
     (+ (Long. 1) (Long. 2)))))

; 46456.174 msecs
(dotimes [_ 1]
  (time
   (dotimes [_ 1000000000]
     (+' 1N 2N))))

I just don't see the two worlds interacting very much. They have different
goals. I'm not going to call out into some generic library in the middle of
my 999,999,999 iteration over a bunch of primitives.

David

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