aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/coll/list.lux16
1 files changed, 14 insertions, 2 deletions
diff --git a/stdlib/source/lux/data/coll/list.lux b/stdlib/source/lux/data/coll/list.lux
index 958ef16df..568aded11 100644
--- a/stdlib/source/lux/data/coll/list.lux
+++ b/stdlib/source/lux/data/coll/list.lux
@@ -204,10 +204,22 @@
[(def: #export (<name> p xs)
(All [a]
(-> (-> a Bool) (List a) Bool))
- (fold (function [_2 _1] (<op> _1 (p _2))) <init> xs))]
+ (loop [xs xs]
+ (case xs
+ #;Nil
+ <init>
+
+ (#;Cons x xs')
+ (case (p x)
+ <init>
+ (recur xs')
+
+ output
+ output))))]
[every? true and]
- [any? false or])
+ [any? false or]
+ )
(def: #export (nth i xs)
{#;doc "Fetches the element at the specified index."}