aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/coll/array.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/data/coll/array.lux')
-rw-r--r--stdlib/source/lux/data/coll/array.lux57
1 files changed, 17 insertions, 40 deletions
diff --git a/stdlib/source/lux/data/coll/array.lux b/stdlib/source/lux/data/coll/array.lux
index b45cab136..0e4afb4a5 100644
--- a/stdlib/source/lux/data/coll/array.lux
+++ b/stdlib/source/lux/data/coll/array.lux
@@ -67,30 +67,17 @@
(def: #export (filter p xs)
(All [a]
(-> (-> a Bool) (Array a) (Array a)))
- (list/fold (: (-> Nat (Array ($ +0)) (Array ($ +0)))
- (function [idx xs']
- (case (read idx xs)
- #.None
- xs'
-
- (#.Some x)
- (if (p x)
- xs'
- (delete idx xs')))))
+ (list/fold (function [idx xs']
+ (case (read idx xs)
+ #.None
+ xs'
+
+ (#.Some x)
+ (if (p x)
+ xs'
+ (delete idx xs'))))
xs
- (list.indices (size xs)))
- ## (list/fold (function [idx xs']
- ## (case (read idx xs)
- ## #.None
- ## xs'
-
- ## (#.Some x)
- ## (if (p x)
- ## xs'
- ## (delete idx xs'))))
- ## xs
- ## (list.indices (size xs)))
- )
+ (list.indices (size xs))))
(def: #export (find p xs)
(All [a]
@@ -198,25 +185,15 @@
(let [arr-size (size ma)]
(if (n/= +0 arr-size)
(new arr-size)
- (list/fold (: (-> Nat (Array ($ +1)) (Array ($ +1)))
- (function [idx mb]
- (case (read idx ma)
- #.None
- mb
-
- (#.Some x)
- (write idx (f x) mb))))
+ (list/fold (function [idx mb]
+ (case (read idx ma)
+ #.None
+ mb
+
+ (#.Some x)
+ (write idx (f x) mb)))
(new arr-size)
(list.n/range +0 (n/dec arr-size)))
- ## (list/fold (function [idx mb]
- ## (case (read idx ma)
- ## #.None
- ## mb
-
- ## (#.Some x)
- ## (write idx (f x) mb)))
- ## (new arr-size)
- ## (list.n/range +0 (n/dec arr-size)))
))))
(struct: #export _ (Fold Array)