It's not free.
(defn set
"Returns a set of the distinct elements of coll."
{:added "1.0"}
[coll] (clojure.lang.PersistentHashSet/create ^clojure.lang.ISeq
(seq coll)))
It seems to go element by element, irrespective of whether it was
given a hashset.
Rob
On Oct 18, 9:43 pm, Phil Hagelberg <[email protected]> wrote:
> It looks like the behaviour of some clojure.set functions is either
> undefined or possibly erroneous when called with non-set arguments:
>
> user> (clojure.set/union #{:a :b} [:b :c])
> #{:a :c :b}
> user> (clojure.set/union #{:a} [:b :c])
> [:b :c :a]
>
> Seems likely that the behaviour in such cases is just undefined, but I
> wonder if it would be worth calling set on each argument just to avoid
> weird edge-case bugs. Is it a cheap operation to call set on a set?
>
> -Phil
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en