We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43e8245 commit c85dd06Copy full SHA for c85dd06
Stdlib/Data/List/Base.juvix
@@ -18,12 +18,8 @@ isElement {A} (eq : A -> A -> Bool) (elem : A) : (list : List A) -> Bool
18
--- 𝒪(𝓃). Returns the leftmost element of the list satisfying the predicate or
19
--- nothing if there is no such element.
20
{-# specialize: [1] #-}
21
-find {A} (predicate : A -> Bool) : (list : List A) -> Maybe A
22
- | nil := nothing
23
- | (x :: xs) :=
24
- if
25
- | predicate x := just x
26
- | else := find predicate xs;
+find {A} (predicate : A -> Bool) : (list : List A) -> Maybe A :=
+ filter predicate >> headMaybe;
27
28
syntax iterator listRfor {init := 1; range := 1};
29
0 commit comments