aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/coll/array.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/coll/array.lux26
1 files changed, 24 insertions, 2 deletions
diff --git a/stdlib/source/lux/data/coll/array.lux b/stdlib/source/lux/data/coll/array.lux
index 2dbf07803..c697e5681 100644
--- a/stdlib/source/lux/data/coll/array.lux
+++ b/stdlib/source/lux/data/coll/array.lux
@@ -78,7 +78,19 @@
xs'
(delete idx xs')))))
xs
- (list;indices (size 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)))
+ )
(def: #export (find p xs)
(All [a]
@@ -195,7 +207,17 @@
(#;Some x)
(write idx (f x) mb))))
(new arr-size)
- (list;n.range +0 (n.dec 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)
(def: (fold f init xs)