Skip to content

Commit 515edb4

Browse files
committed
- (.-length array) -> (alength array)
- add missing -contains-key? method to Vector
1 parent b017493 commit 515edb4

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12261,11 +12261,11 @@ reduces them without incurring seq initialization"
1226112261

1226212262
IStack
1226312263
(-peek [coll]
12264-
(let [count (.-length array)]
12264+
(let [count (alength array)]
1226512265
(when (> count 0)
1226612266
(aget array (dec count)))))
1226712267
(-pop [coll]
12268-
(if (> (.-length array) 0)
12268+
(if (> (alength array) 0)
1226912269
(let [new-array (aclone array)]
1227012270
(. new-array (pop))
1227112271
(Vector. meta new-array nil))
@@ -12289,24 +12289,24 @@ reduces them without incurring seq initialization"
1228912289

1229012290
ISeqable
1229112291
(-seq [coll]
12292-
(when (> (.-length array) 0)
12292+
(when (> (alength array) 0)
1229312293
(let [vector-seq
1229412294
(fn vector-seq [i]
1229512295
(lazy-seq
12296-
(when (< i (.-length array))
12296+
(when (< i (alength array))
1229712297
(cons (aget array i) (vector-seq (inc i))))))]
1229812298
(vector-seq 0))))
1229912299

1230012300
ICounted
12301-
(-count [coll] (.-length array))
12301+
(-count [coll] (alength array))
1230212302

1230312303
IIndexed
1230412304
(-nth [coll n]
12305-
(if (and (<= 0 n) (< n (.-length array)))
12305+
(if (and (<= 0 n) (< n (alength array)))
1230612306
(aget array n)
12307-
#_(throw (js/Error. (str "No item " n " in vector of length " (.-length array))))))
12307+
#_(throw (js/Error. (str "No item " n " in vector of length " (alength array))))))
1230812308
(-nth [coll n not-found]
12309-
(if (and (<= 0 n) (< n (.-length array)))
12309+
(if (and (<= 0 n) (< n (alength array)))
1231012310
(aget array n)
1231112311
not-found))
1231212312

@@ -12319,6 +12319,11 @@ reduces them without incurring seq initialization"
1231912319
(let [new-array (aclone array)]
1232012320
(aset new-array k v)
1232112321
(Vector. meta new-array nil)))
12322+
(-contains-key? [coll k]
12323+
(if (integer? k)
12324+
(and (<= 0 k) (< k (alength array)))
12325+
false))
12326+
1232212327

1232312328
IVector
1232412329
(-assoc-n [coll n val] (-assoc coll n val))

0 commit comments

Comments
 (0)