CCSeqHelpers for the standard Seq type
See oseq for a richer API.
type 'a printer = Format.formatter -> 'a -> unittype !'a t = unit -> 'a nodeval is_empty : 'a t -> boolval length : 'a t -> intval iter : ('a -> unit) -> 'a t -> unitval iteri : (int -> 'a -> unit) -> 'a t -> unitval fold_lefti : ('acc -> int -> 'a -> 'acc) -> 'acc -> 'a t -> 'accval for_all : ('a -> bool) -> 'a t -> boolval exists : ('a -> bool) -> 'a t -> boolval find : ('a -> bool) -> 'a t -> 'a optionval find_index : ('a -> bool) -> 'a t -> int optionval find_map : ('a -> 'b option) -> 'a t -> 'b optionval find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b optionval empty : 'a tval return : 'a -> 'a tval init : int -> (int -> 'a) -> 'a tval unfold : ('b -> ('a * 'b) option) -> 'b -> 'a tval forever : (unit -> 'a) -> 'a tval iterate : ('a -> 'a) -> 'a -> 'a tval of_dispenser : (unit -> 'a option) -> 'a tval to_dispenser : 'a t -> unit -> 'a optionval ints : int -> int tval nil : 'a tval singleton : 'a -> 'a tval repeat : ?n:int -> 'a -> 'a trepeat ~n x repeats x n times then stops. If n is omitted, then x is repeated forever.
val head : 'a t -> 'a optionHead of the list.
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'aFold on values.
val foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'afold_lefti f init xs applies f acc i x where acc is the result of the previous computation or init for the first one, i is the index in the sequence (starts at 0) and x is the element of the sequence.
Similar to filter but the predicate takes aditionally the index of the elements.
Alias of filter_map.
Fair product of two (possibly infinite) lists into a new list. Lazy. The first parameter is used to combine each pair of elements.
uniq eq l returns l but removes consecutive duplicates. Lazy. In other words, if several values that are equal follow one another, only the first of them is kept.
val range : int -> int -> int tval (--) : int -> int -> int ta -- b is the range of integers containing a and b (therefore, never empty).
val (--^) : int -> int -> int ta --^ b is the integer range from a to b, where b is excluded.
Alias for fold_left2.
Alias of sorted_merge.
Eager sort. Require the iterator to be finite. O(n ln(n)) time and space.
Eager sort that removes duplicate values. Require the iterator to be finite. O(n ln(n)) time and space.
val pure : 'a -> 'a tInfix version of fair_flat_map.
module Infix : sig ... endmodule type MONAD = sig ... endval of_list : 'a list -> 'a tval to_list : 'a t -> 'a listGather all values into a list.
val of_array : 'a array -> 'a tIterate on the array.
val to_array : 'a t -> 'a arrayConvert into array.
val of_string : string -> char tIterate on characters.
val pp :
?pp_start:unit printer ->
?pp_stop:unit printer ->
?pp_sep:unit printer ->
'a printer ->
'a t printerpp ~pp_start ~pp_stop ~pp_sep pp_item ppf s formats the sequence s on ppf. Each element is formatted with pp_item, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").