Through version 1.2.0, Clojure used Java's Object.equals method for map 
lookups.  Java specifies Object.equals to be false for numbers of different 
types.

Clojure 1.3.0-alpha* uses its own = function for map lookups specifically to 
avoid this problem.  The = function is true for numbers of different types 
but the same value.  Note that Java code dealing with Clojure maps using the 
java.util.Map interface will still get the standard Java behavior using 
Object.equals.

Clojure 1.3.0-alpha* also uses longs by default for all integer literals.

    Clojure 1.3.0-master-SNAPSHOT
    user=> (def m {1 10 2 20})
    #'user/m
    user=> (m 2)
    20
    user=> (m (long 2))
    20
    user=> (type 2)
    java.lang.Long

Stuart Sierra
clojure.com

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