Skip to content

Commit 393a594

Browse files
committed
- simple-map-entry needs to satisfy IVector and IIndexed
1 parent 73c5b89 commit 393a594

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10385,11 +10385,22 @@ reduces them without incurring seq initialization"
1038510385

1038610386
(defn- simple-map-entry [k v]
1038710387
(reify
10388+
IVector
10389+
(-assoc-n [_ n x]
10390+
(case n
10391+
0 (simple-map-entry x v)
10392+
1 (simple-map-entry k x)
10393+
(throw (js/Error. "Index out of bounds"))))
1038810394
IMapEntry
1038910395
(-key [_] k)
1039010396
(-val [_] v)
1039110397
ISeqable
10392-
(-seq [_] (IndexedSeq. #js [k v] 0 nil))))
10398+
(-seq [_] (IndexedSeq. #js [k v] 0 nil))
10399+
IIndexed
10400+
(-nth [_ i]
10401+
(case i, 0 k, 1 v, (throw (js/Error. "Index out of bounds"))))
10402+
(-nth [_ i not-found]
10403+
(case i, 0 k, 1 v, not-found))))
1039310404

1039410405
(defn- pr-writer-impl
1039510406
[obj writer opts]

0 commit comments

Comments
 (0)