Yes, this has been discussed extensively in the past....I think the
convention is to use the ctor functions if you're passing data
dynamically, otherwise if dealing with constants the literals should be
just fine...In the case just replace the set literal with (hash-set ...)
or (set ...).
hope that helps...
Jim
On 12/11/12 08:48, Antony Lee wrote:
I may arrive at the party a little late but just to mention I got
bitten by this too (while working on clojure-py, so I actually want to
know about the weird edge cases...)
user=> #{(rand-int 100) (rand-int 100)}
IllegalArgumentException Duplicate key: (rand-int 100)
clojure.lang.PersistentHashSet.createWithCheck
(PersistentHashSet.java:68)
Of course you can even replace rand-int by a function which is
actually guaranteed to return different values on consecutive calls,
e.g. a closure over an atom.
--
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
--
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