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
val append_no_duplicates :
cmp:('a -> 'a -> int) ->
('a list -> 'a list -> 'a list) IStdlib.IStd.Staged.t
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
val fold2_result :
init:'acc ->
f:('acc -> 'a -> 'b -> ('acc, 'err) IStd.result) ->
'a list ->
'b list ->
('acc, 'err) IStd.result Base.List.Or_unequal_lengths.t
val foldi_result :
init:'acc ->
f:(int -> 'acc -> 'a -> ('acc, 'err) IStd.result) ->
'a list ->
('acc, 'err) IStd.result