>
> Most of the time when people call seq on a set or map they want to iterate
> over it, and that's fine.
Right, I guess I meant insertion order.
Though, is it not true that conceptually, two implementations of
IPersistentSet would not need to return elements in the same order? Even to
the
>> If it happens to work, it is accidental, and should not be relied on.
Yes, and no. The actual order may change between Clojure releases (last
time it changed was with 1.6), or between two equal collections, but the
ordering will not change between two calls to `seq` on the same instance of
a h
This makes me think that transients could (should?) be made reducible.
On Sat, Feb 24, 2018 at 4:19 PM, Timothy Baldridge
wrote:
> Yes, transients mutate when updated. Seqs over sets are a immutable view
> over a collection. So if someone did get this to work, the implementation
> could be incor
>
> is there a way round it?
>
Something else I need to point out is that you really should not use a Set
for order. Sets are specifically unordered, and provide no guarantees of
order. Try calling first, second and last on #{1 2 3} for example, you'll
probably get things back in a different
Clojure tends to blur the lines between its different types of collections
and sequences, because of how most functions often know how to work with
all of them and others will coerce them automatically from one type to
another. This makes it that 99% of the time, everything just works like
magi
Yes, transients mutate when updated. Seqs over sets are a immutable view
over a collection. So if someone did get this to work, the implementation
could be incorrect. And you could get something really strange like this:
(def s (transient #{1 2}))
(def sq (seq s))
(first sq) => 1
(disj s 1)
(secon
Calling (first #{1}) gives the result 1.
Calling (first (transient #{1})) gives an error:
“IllegalArgumentException Don't know how to create ISeq from:
clojure.lang.PersistentHashSet$TransientHashSet clojure.lang.RT.seqFrom
(RT.java:550)”
Is this behaviour intended?
And whether or not this i