package alg_structs
Module Foldable.ArraySource
Implemented by Stdlib.ArrayLabels.
fold m t folds the elements of t with m.op. E.g.,
# Foldable.List.fold (module Monoid.Int.Sum) [1;2;3;4];;
- : int = 10fold_map ~m ~f t is a map of the elements of t in the monoid m combines with m.op.
E.g.,
# Foldable.List.fold_map ~m:(module Monoid.Int.Sum) ~f:int_of_string ["1";"2";"3";"4"];;
- : int = 10fold_left ~f ~init t combines the elements of t using f from the left.
any ~f t is true if the predicate f holds for any element of t
all ~f t is true if the predicate f holds for every element of t
mem t x ~equal is true if there's an element y in t such that equal x t is true
max ~compare t is Some x when x is the maximum value in t, as determined by compare, or None if is_empty t.