Compat.List
is_empty l
is true if and only if l
has no elements. It is equivalent to compare_length_with l 0 = 0
.
equal eq [a1; ...; an] [b1; ..; bm]
holds when the two input lists have the same length, and for each pair of elements ai
, bi
at the same position we have eq ai bi
.
Note: the eq
function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths
first.
compare cmp [a1; ...; an] [b1; ...; bm]
performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int
interface as Stdlib.compare
:
a1 :: l1
is smaller than a2 :: l2
(negative result) if a1
is smaller than a2
, or if they are equal (0 result) and l1
is smaller than l2
[]
is strictly smaller than non-empty listsNote: the cmp
function will be called even if the lists have different lengths.
find_map f l
applies f
to the elements of l
in order, and returns the first result of the form Some v
, or None
if none exist.