I have a function that returns unique ID every time it is called. If I try to create a new map with two entries, both having a unique key generated by that function, I get IllegalArgumentException Duplicate key exception. For example:
user=> *(def id (atom 0))* user=> *(defn generate-id [] (swap! id inc))* user=> user=> *{(generate-id) "foo" (generate-id) "bar"}* IllegalArgumentException Duplicate key: (generate-id) clojure.lang.PersistentArrayMap.createWithCheck (PersistentArrayMap.java:70) How ever, it works just fine if I do it like this: user=> *(let [id1 (generate-id) id2 (generate-id)] {id1 "foo" id2 "bar"})* {3 "foo", 4 "bar"} Is this a bug, or am I doing something wrong here? I'm using Clojure 1.4. -- -jarppe -- 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