B0_std.List
Lists.
List
include module type of Stdlib.List
find_map f l
is the first element of l
such that f v
is Some r
or None
otherwise.
Note. Available in 4.10.
concat_map f l
maps l
with f
and concatenates the result. Tail recursive.
Note. Available in 4.10.
val classify :
?cmp_elts:('a -> 'a -> int) ->
?cmp_classes:('b -> 'b -> int) ->
classes:('a -> 'b list) ->
'a list ->
('b * 'a list) list
classify ~cmp_elts ~cmp_classes ~classes els
bins elements els
into classes as determined by classes
. cmp_elts
is used to compare elements and cmp_classes
to compare classes, both default to compare
.
distinct cmp l
are the distinct elements of l
according to cmp
. The first occurence of an element in l
is kept and their order in l
is preserved.
val fold_stop_on_error :
('a -> 'b -> ('b, 'e) Stdlib.result) ->
'a list ->
'b ->
('b, 'e) Stdlib.result
fold_stop_on_error f l acc
folds f
on the elements of l
starting with acc
and stops at the first error.
iter_stop_on_error f acc
applies f
to the elements of l
and stops at the first error.