Module Basics.LIST

val split_at_first : ('a -> bool) -> prefix:[ `Rev | `Same ] -> where:[ `After | `Around | `Before ] -> 'a list -> ('a list * 'a list, unit) Stdlib.result

split_at_first ~prefix ~where p list splits list right after, right before, or around the first element e that satisfies p e.

prefix indicates whether or not to keep the prefix in revered order, and where instructs where to split (`Around discards the element).

val fold_left_while : ('a -> bool) -> ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a

fold_left_while pred f acc l is (f (... (f acc l1) ...) ln) with l1 ln the elements of l for which pred acc is satisfied.