As David mentioned, *unchecked-math* is documented as a compile-time flag.

The coercion functions are a bit muddled by the changes to primitive math 
in 1.3. In Clojure 1.2, you could get primitive int inside loop/recur by 
calling `int` in the loop initialization. You can still do that in 1.3, but 
coercions inside loops are used less often because functions can now have 
primitive arguments. Primitive function args are restricted to longs and 
doubles, so the default numeric types in 1.3 are 
java.lang.Long/java.lang.Double, and that's what the Reader returns for 
numeric literals:

user=> (class (read-string "0xffffffff"))
java.lang.Long

Clojure won't ever give you a primitive 32-bit int outside of loop/recur, 
which is a frequent subject of confusion. Even if you coerce to `int`, the 
result is boxed as a java.lang.Long:

user=> (class (int 32))
java.lang.Long

If you need an unchecked 32-bit trucate operation, you can use the 
java.lang.Number.intValue() method:

user=> (map #(.intValue %) [33 77 0xffffffff])
(33 77 -1)

But even then, you're still getting java.lang.Longs back:

user=> (class (.intValue 0xffffffff))
java.lang.Long

Hope this helps,
-S

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