@@ -12432,6 +12432,8 @@ reduces them without incurring seq initialization"
12432
12432
IPrintWithWriter
12433
12433
(-pr-writer [coll writer opts] (pr-sequential-writer writer pr-writer " [" " " " ]" opts coll)))
12434
12434
12435
+ (es6-iterable PersistentVector)
12436
+
12435
12437
(set! (. Vector -EMPTY) (Vector. nil (array ) nil ))
12436
12438
12437
12439
(set! (. Vector -fromArray) (fn [xs] (Vector. nil xs nil )))
@@ -12501,19 +12503,38 @@ reduces them without incurring seq initialization"
12501
12503
i
12502
12504
(recur (+ i incr)))))))
12503
12505
12504
- (deftype ObjMap [meta keys strobj ^:mutable __hash]
12506
+ (deftype ObjMap [meta strkeys strobj ^:mutable __hash]
12505
12507
Object
12506
12508
(toString [coll]
12507
12509
(pr-str* coll))
12510
+ (keys [coll]
12511
+ (es6-iterator
12512
+ (prim-seq
12513
+ (.map (.sort strkeys obj-map-compare-keys)
12514
+ obj-map-key->keyword))))
12515
+ (entries [coll]
12516
+ (es6-entries-iterator (-seq coll)))
12517
+ (values [coll]
12518
+ (es6-iterator
12519
+ (prim-seq
12520
+ (.map (.sort strkeys obj-map-compare-keys)
12521
+ #(unchecked-get strobj %)))))
12522
+ (has [coll k]
12523
+ (contains? coll k))
12524
+ (get [coll k not-found]
12525
+ (-lookup coll k not-found))
12526
+ (forEach [coll f]
12527
+ (.forEach (.sort strkeys obj-map-compare-keys)
12528
+ #(f (unchecked-get strobj %) (obj-map-key->keyword %))))
12508
12529
12509
12530
IWithMeta
12510
- (-with-meta [coll meta] (ObjMap. meta keys strobj __hash))
12531
+ (-with-meta [coll meta] (ObjMap. meta strkeys strobj __hash))
12511
12532
12512
12533
IMeta
12513
12534
(-meta [coll] meta)
12514
12535
12515
12536
ICloneable
12516
- (-clone [coll] (ObjMap. meta keys strobj __hash))
12537
+ (-clone [coll] (ObjMap. meta strkeys strobj __hash))
12517
12538
12518
12539
ICollection
12519
12540
(-conj [coll entry]
@@ -12532,33 +12553,33 @@ reduces them without incurring seq initialization"
12532
12553
12533
12554
ISeqable
12534
12555
(-seq [coll]
12535
- (when (pos? (alength keys ))
12556
+ (when (pos? (alength strkeys ))
12536
12557
(prim-seq
12537
- (.map (.sort keys obj-map-compare-keys)
12558
+ (.map (.sort strkeys obj-map-compare-keys)
12538
12559
#(simple-map-entry (obj-map-key->keyword %) (unchecked-get strobj %))))))
12539
12560
12540
12561
ICounted
12541
- (-count [coll] (alength keys ))
12562
+ (-count [coll] (alength strkeys ))
12542
12563
12543
12564
ILookup
12544
12565
(-lookup [coll k] (-lookup coll k nil ))
12545
12566
(-lookup [coll k not-found]
12546
12567
(let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12547
12568
(if (and (string? k)
12548
- (not (nil? (scan-array 1 k keys ))))
12569
+ (not (nil? (scan-array 1 k strkeys ))))
12549
12570
(unchecked-get strobj k)
12550
12571
not-found)))
12551
12572
12552
12573
IAssociative
12553
12574
(-assoc [coll k v]
12554
12575
(let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12555
12576
(if (string? k)
12556
- (if-not (nil? (scan-array 1 k keys ))
12557
- (let [new-strobj (obj-clone strobj keys )]
12577
+ (if-not (nil? (scan-array 1 k strkeys ))
12578
+ (let [new-strobj (obj-clone strobj strkeys )]
12558
12579
(gobject/set new-strobj k v)
12559
- (ObjMap. meta keys new-strobj nil )) ; overwrite
12560
- (let [new-strobj (obj-clone strobj keys ) ; append
12561
- new-keys (aclone keys )]
12580
+ (ObjMap. meta strkeys new-strobj nil )) ; overwrite
12581
+ (let [new-strobj (obj-clone strobj strkeys ) ; append
12582
+ new-keys (aclone strkeys )]
12562
12583
(gobject/set new-strobj k v)
12563
12584
(.push new-keys k)
12564
12585
(ObjMap. meta new-keys new-strobj nil )))
@@ -12572,21 +12593,21 @@ reduces them without incurring seq initialization"
12572
12593
(-contains-key? [coll k]
12573
12594
(let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12574
12595
(if (and (string? k)
12575
- (not (nil? (scan-array 1 k keys ))))
12596
+ (not (nil? (scan-array 1 k strkeys ))))
12576
12597
true
12577
12598
false )))
12578
12599
12579
12600
IFind
12580
12601
(-find [coll k]
12581
12602
(let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12582
12603
(when (and (string? k)
12583
- (not (nil? (scan-array 1 k keys ))))
12604
+ (not (nil? (scan-array 1 k strkeys ))))
12584
12605
(MapEntry. k (unchecked-get strobj k) nil ))))
12585
12606
12586
12607
IKVReduce
12587
12608
(-kv-reduce [coll f init]
12588
- (let [len (alength keys )]
12589
- (loop [keys (.sort keys obj-map-compare-keys)
12609
+ (let [len (alength strkeys )]
12610
+ (loop [keys (.sort strkeys obj-map-compare-keys)
12590
12611
init init]
12591
12612
(if (seq keys)
12592
12613
(let [k (first keys)
@@ -12600,9 +12621,9 @@ reduces them without incurring seq initialization"
12600
12621
(-dissoc [coll k]
12601
12622
(let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12602
12623
(if (and (string? k)
12603
- (not (nil? (scan-array 1 k keys ))))
12604
- (let [new-keys (aclone keys )
12605
- new-strobj (obj-clone strobj keys )]
12624
+ (not (nil? (scan-array 1 k strkeys ))))
12625
+ (let [new-keys (aclone strkeys )
12626
+ new-strobj (obj-clone strobj strkeys )]
12606
12627
(.splice new-keys (scan-array 1 k new-keys) 1 )
12607
12628
(js-delete new-strobj k)
12608
12629
(ObjMap. meta new-keys new-strobj nil ))
@@ -12643,6 +12664,8 @@ reduces them without incurring seq initialization"
12643
12664
(-pr-writer [coll writer opts]
12644
12665
(print-map coll pr-writer writer opts)))
12645
12666
12667
+ (es6-iterable ObjMap)
12668
+
12646
12669
(set! (. ObjMap -EMPTY) (ObjMap. nil (array ) (js-obj ) empty-ordered-hash))
12647
12670
12648
12671
(set! (. ObjMap -fromObject) (fn [ks obj] (ObjMap. nil ks obj nil )))
@@ -12678,6 +12701,21 @@ reduces them without incurring seq initialization"
12678
12701
Object
12679
12702
(toString [coll]
12680
12703
(pr-str* coll))
12704
+ (keys [coll]
12705
+ (es6-iterator (map #(-key %) (-seq coll))))
12706
+ (entries [coll]
12707
+ (es6-entries-iterator (-seq coll)))
12708
+ (values [coll]
12709
+ (es6-iterator (map #(-val %) (-key coll))))
12710
+ (has [coll k]
12711
+ (contains? coll k))
12712
+ (get [coll k not-found]
12713
+ (-lookup coll k not-found))
12714
+ (forEach [coll f]
12715
+ (let [xs (-seq coll)]
12716
+ (when-not (nil? xs)
12717
+ (.forEach (.-arr xs)
12718
+ #(f (-val %) (-key %))))))
12681
12719
12682
12720
IWithMeta
12683
12721
(-with-meta [coll meta] (HashMap. meta count hashobj __hash))
@@ -12813,6 +12851,8 @@ reduces them without incurring seq initialization"
12813
12851
(-pr-writer [coll writer opts]
12814
12852
(print-map coll pr-writer writer opts)))
12815
12853
12854
+ (es6-iterable HashMap)
12855
+
12816
12856
(set! (. HashMap -EMPTY) (HashMap. nil 0 (js-obj ) empty-unordered-hash))
12817
12857
12818
12858
(set! (. HashMap -fromArrays) (fn [ks vs]
@@ -12835,6 +12875,19 @@ reduces them without incurring seq initialization"
12835
12875
Object
12836
12876
(toString [coll]
12837
12877
(pr-str* coll))
12878
+ (keys [coll]
12879
+ (es6-iterator (-seq coll)))
12880
+ (entries [coll]
12881
+ (es6-set-entries-iterator (-seq coll)))
12882
+ (values [coll]
12883
+ (es6-iterator (-seq coll)))
12884
+ (has [coll k]
12885
+ (contains? coll k))
12886
+ (forEach [coll f]
12887
+ (let [xs (-seq hash-map)]
12888
+ (when (some? xs)
12889
+ (.forEach (.-arr xs)
12890
+ #(f (-val %) (-key %))))))
12838
12891
12839
12892
IWithMeta
12840
12893
(-with-meta [coll meta] (Set. meta hash-map __hash))
@@ -12911,6 +12964,8 @@ reduces them without incurring seq initialization"
12911
12964
IPrintWithWriter
12912
12965
(-pr-writer [coll writer opts] (pr-sequential-writer writer pr-writer " #{" " " " }" opts coll)))
12913
12966
12967
+ (es6-iterable Set)
12968
+
12914
12969
(set! (. Set -EMPTY) (Set. nil (. HashMap -EMPTY) empty-unordered-hash))
12915
12970
12916
12971
(defn simple-set
0 commit comments