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 b50851a commit e124c13Copy full SHA for e124c13
Stdlib/Data/List/Base.juvix
@@ -165,6 +165,11 @@ head {A} (defaultValue : A) (list : List A) : A :=
165
| x :: _ := x
166
| nil := defaultValue;
167
168
+--- 𝒪(1). Grabs the first element of a ;List;
169
+headMaybe {A} : List A -> Maybe A
170
+ | (x :: _) := just x
171
+ | nil := nothing;
172
+
173
syntax iterator any {init := 0; range := 1};
174
175
--- 𝒪(𝓃). Returns ;true; if at least one element of the ;List; satisfies the predicate.
0 commit comments