IStdlib.IList
like map, but returns the original list if unchanged
like filter, but returns the original list if unchanged
Remove consecutive equal irrelevant elements from a list (according to the given comparison and relevance functions)
The function works on sorted lists without duplicates, and keeps only one copy of elements that appear in both lists.
inter cmp xs ys
are the elements in both xs
and ys
, sorted according to cmp
.
like fold, but apply f_last to the last element
split_last_rev l
is Some (last, rev_prefix)
where l == List.rev (last :: rev_prefix)
, None
if l
is empty
append_no_duplicates list1 list2
, assuming that list1 and list2 have no duplicates on their own, it computes list1 @ (filtered list2)
, so it keeps the order of both lists and has no duplicates.
drop l n
returns l
without the first n
elements, or the empty list if n > length l
.
opt_cons None l
returns l
. opt_cons (Some x) l
returns x :: l
given a list of functions taking unit, evaluate and return the first one to return Some x
Applies f
to the elements of the list and returns None
if any application results in None
otherwise returns Some list'
.