Skip to content

Commit 5ad96a8

Browse files
committed
CLJS-3164: Optimize assoc on IAssociative values
1 parent d79eda3 commit 5ad96a8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,9 +1973,11 @@ reduces them without incurring seq initialization"
19731973
val(s). When applied to a vector, returns a new vector that
19741974
contains val at index. Note - index must be <= (count vector)."
19751975
([coll k v]
1976-
(if-not (nil? coll)
1977-
(-assoc coll k v)
1978-
(array-map k v)))
1976+
(if (implements? IAssociative coll)
1977+
(-assoc coll k v)
1978+
(if-not (nil? coll)
1979+
(-assoc coll k v)
1980+
(array-map k v))))
19791981
([coll k v & kvs]
19801982
(let [ret (assoc coll k v)]
19811983
(if kvs

0 commit comments

Comments
 (0)