Closed Aeonax closed 2 months ago
Oops @Aeonax that was me. Sorry for the breakage. @weavejester I've got a branch that defaults to the old behaviour if the collection isn't editable. lmk what you think.
Thanks @tomdl89 for raising the issue and @Aeonax for putting together a fix.
Can we take out the partition
to avoid generating another lazy seq? e.g.
(if (editable? m)
(loop [acc (assoc-some-transient! (transient (or m {})) k v)
kvs kvs]
(if (next kvs)
(recur (assoc-some-transient! acc (first kvs) (second kvs)) (nnext kvs))
(if (zero? (count acc))
m
(persistent! acc))))
(loop [acc (assoc-some m k v), kvs kvs]
(if (next kvs)
(recur (assoc-some acc (first kvs) (second kvs)) (nnext kvs))
acc)))
Other way round, but yup, no worries. I've added a PR using a loop
to avoid the intermediate lazy-seq.
Any thoughts on when it will be released?
I've released 1.8.1 with the fix.
By the way, just noticed that meta is lost after "default" assoc-some
, is it a known issue?
I don't think it is a known issue @Aeonax. I've raised a PR to fix.
I don't think https://github.com/weavejester/medley/issues/13 is relevant, as it is comparing to map
and co (which don't preserve metadata) whereas assoc-some
should be compared to assoc
which does.
It appears that this commit introduces a breaking change. After updating from version
1.4.0
, we encounter an error when attempting to useassoc-some
on custom types:I didn't notice any existing issues regarding this "bug" or mentions somewhere and I'm not entirely sure if it's appropriate to classify it as a bug.😅