diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/collection/sequence.lux | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index a7fa5cb75..10bbfa9d0 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -103,19 +103,20 @@ (let [[next x] (step init)] (//.pending [x (unfold step next)]))) -(def: #export (filter predicate sequence) +(def: #export (only predicate sequence) (All [a] (-> (-> a Bit) (Sequence a) (Sequence a))) (let [[head tail] (//.run sequence)] (if (predicate head) - (//.pending [head (filter predicate tail)]) - (filter predicate tail)))) + (//.pending [head (only predicate tail)]) + (only predicate tail)))) (def: #export (partition left? xs) {#.doc (doc "Split a sequence in two based on a predicate." "The left side contains all entries for which the predicate is #1." "The right side contains all entries for which the predicate is #0.")} (All [a] (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)])) - [(filter left? xs) (filter (bit.complement left?) xs)]) + [(..only left? xs) + (..only (bit.complement left?) xs)]) (implementation: #export functor (Functor Sequence) |