Module Core_kernel.Sequence

This module extends Base.Sequence with bin_io.

module Merge_with_duplicates_element : sig ... end
include module type of sig ... end with module Merge_with_duplicates_element := Merge_with_duplicates_element
type 'a t = 'a Base__Sequence.t
val compare : ('a ‑> 'a ‑> int) ‑> 'a t ‑> 'a t ‑> int
val sexp_of_t : ('a ‑> Base.Sexp.t) ‑> 'a t ‑> Base.Sexp.t
type 'a sequence = 'a t
val mem : 'a t ‑> 'a ‑> equal:('a ‑> 'a ‑> bool) ‑> bool
val length : 'a t ‑> int
val is_empty : 'a t ‑> bool
val iter : 'a t ‑> f:('a ‑> unit) ‑> unit
val fold : 'a t ‑> init:'accum ‑> f:('accum ‑> 'a ‑> 'accum) ‑> 'accum
val fold_result : 'a t ‑> init:'accum ‑> f:('accum ‑> 'a ‑> ('accum'eBase.Result.t) ‑> ('accum'eBase.Result.t
val fold_until : 'a t ‑> init:'accum ‑> f:('accum ‑> 'a ‑> ('accum'finalBase__.Container_intf.Continue_or_stop.t) ‑> finish:('accum ‑> 'final) ‑> 'final
val exists : 'a t ‑> f:('a ‑> bool) ‑> bool
val for_all : 'a t ‑> f:('a ‑> bool) ‑> bool
val count : 'a t ‑> f:('a ‑> bool) ‑> int
val sum : (module Base.Commutative_group.S with type t = 'sum) ‑> 'a t ‑> f:('a ‑> 'sum) ‑> 'sum
val find : 'a t ‑> f:('a ‑> bool) ‑> 'a option
val find_map : 'a t ‑> f:('a ‑> 'b option) ‑> 'b option
val to_list : 'a t ‑> 'a list
val to_array : 'a t ‑> 'a array
val min_elt : 'a t ‑> compare:('a ‑> 'a ‑> int) ‑> 'a option
val max_elt : 'a t ‑> compare:('a ‑> 'a ‑> int) ‑> 'a option
val foldi : ('a t'a'bBase__.Indexed_container_intf.foldi
val iteri : ('a t'aBase__.Indexed_container_intf.iteri
val existsi : 'a t ‑> f:(int ‑> 'a ‑> bool) ‑> bool
val counti : 'a t ‑> f:(int ‑> 'a ‑> bool) ‑> int
val findi : 'a t ‑> f:(int ‑> 'a ‑> bool) ‑> (int * 'a) option
val find_mapi : 'a t ‑> f:(int ‑> 'a ‑> 'b option) ‑> 'b option
val (>>=) : 'a t ‑> ('a ‑> 'b t) ‑> 'b t
val (>>|) : 'a t ‑> ('a ‑> 'b) ‑> 'b t
val bind : 'a t ‑> f:('a ‑> 'b t) ‑> 'b t
val return : 'a ‑> 'a t
val map : 'a t ‑> f:('a ‑> 'b) ‑> 'b t
val join : 'a t t ‑> 'a t
val ignore_m : 'a t ‑> unit t
val all : 'a t list ‑> 'a list t
val all_unit : unit t list ‑> unit t
val all_ignore : unit t list ‑> unit t
  • Deprecated [since 2018-02] Use [all_unit]
val empty : 'a t
val next : 'a t ‑> ('a * 'a t) option
val unfold_step : init:'s ‑> f:('s ‑> ('a'sStep.t) ‑> 'a t
val unfold : init:'s ‑> f:('s ‑> ('a * 's) option) ‑> 'a t
val unfold_with : 'a t ‑> init:'s ‑> f:('s ‑> 'a ‑> ('b'sStep.t) ‑> 'b t
val unfold_with_and_finish : 'a t ‑> init:'s_a ‑> running_step:('s_a ‑> 'a ‑> ('b's_aStep.t) ‑> inner_finished:('s_a ‑> 's_b) ‑> finishing_step:('s_b ‑> ('b's_bStep.t) ‑> 'b t
val nth : 'a t ‑> int ‑> 'a option
val nth_exn : 'a t ‑> int ‑> 'a
val folding_map : 'a t ‑> init:'b ‑> f:('b ‑> 'a ‑> 'b * 'c) ‑> 'c t
val folding_mapi : 'a t ‑> init:'b ‑> f:(int ‑> 'b ‑> 'a ‑> 'b * 'c) ‑> 'c t
val mapi : 'a t ‑> f:(int ‑> 'a ‑> 'b) ‑> 'b t
val filteri : 'a t ‑> f:(int ‑> 'a ‑> bool) ‑> 'a t
val filter : 'a t ‑> f:('a ‑> bool) ‑> 'a t
val merge : 'a t ‑> 'a t ‑> cmp:('a ‑> 'a ‑> int) ‑> 'a t
val merge_with_duplicates : 'a t ‑> 'b t ‑> cmp:('a ‑> 'b ‑> int) ‑> ('a'bMerge_with_duplicates_element.t t
val hd : 'a t ‑> 'a option
val hd_exn : 'a t ‑> 'a
val tl : 'a t ‑> 'a t option
val tl_eagerly_exn : 'a t ‑> 'a t
val find_exn : 'a t ‑> f:('a ‑> bool) ‑> 'a
val for_alli : 'a t ‑> f:(int ‑> 'a ‑> bool) ‑> bool
val append : 'a t ‑> 'a t ‑> 'a t
val concat : 'a t t ‑> 'a t
val concat_map : 'a t ‑> f:('a ‑> 'b t) ‑> 'b t
val concat_mapi : 'a t ‑> f:(int ‑> 'a ‑> 'b t) ‑> 'b t
val interleave : 'a t t ‑> 'a t
val round_robin : 'a t list ‑> 'a t
val zip : 'a t ‑> 'b t ‑> ('a * 'b) t
val zip_full : 'a t ‑> 'b t ‑> [ `Both of 'a * 'b | `Left of 'a | `Right of 'b ] t
val reduce_exn : 'a t ‑> f:('a ‑> 'a ‑> 'a) ‑> 'a
val reduce : 'a t ‑> f:('a ‑> 'a ‑> 'a) ‑> 'a option
val group : 'a t ‑> break:('a ‑> 'a ‑> bool) ‑> 'a list t
val find_consecutive_duplicate : 'a t ‑> equal:('a ‑> 'a ‑> bool) ‑> ('a * 'a) option
val remove_consecutive_duplicates : 'a t ‑> equal:('a ‑> 'a ‑> bool) ‑> 'a t
val range : ?⁠stride:int ‑> ?⁠start:[ `exclusive | `inclusive ] ‑> ?⁠stop:[ `exclusive | `inclusive ] ‑> int ‑> int ‑> int t
val init : int ‑> f:(int ‑> 'a) ‑> 'a t
val filter_map : 'a t ‑> f:('a ‑> 'b option) ‑> 'b t
val filter_mapi : 'a t ‑> f:(int ‑> 'a ‑> 'b option) ‑> 'b t
val filter_opt : 'a option t ‑> 'a t
val sub : 'a t ‑> pos:int ‑> len:int ‑> 'a t
val take : 'a t ‑> int ‑> 'a t
val drop : 'a t ‑> int ‑> 'a t
val drop_eagerly : 'a t ‑> int ‑> 'a t
val take_while : 'a t ‑> f:('a ‑> bool) ‑> 'a t
val drop_while : 'a t ‑> f:('a ‑> bool) ‑> 'a t
val drop_while_option : 'a t ‑> f:('a ‑> bool) ‑> ('a * 'a t) option
val split_n : 'a t ‑> int ‑> 'a list * 'a t
val split_n_eagerly : 'a t ‑> int ‑> 'a t * 'a t
  • Deprecated [since 2015-11] Use {!Sequence.split_n} instead.
val chunks_exn : 'a t ‑> int ‑> 'a list t
val shift_right : 'a t ‑> 'a ‑> 'a t
val shift_right_with_list : 'a t ‑> 'a list ‑> 'a t
val shift_left : 'a t ‑> int ‑> 'a t
val cartesian_product : 'a t ‑> 'b t ‑> ('a * 'b) t
val interleaved_cartesian_product : 'a t ‑> 'b t ‑> ('a * 'b) t
val intersperse : 'a t ‑> sep:'a ‑> 'a t
val cycle_list_exn : 'a list ‑> 'a t
val repeat : 'a ‑> 'a t
val singleton : 'a ‑> 'a t
val delayed_fold : 'a t ‑> init:'s ‑> f:('s ‑> 'a ‑> k:('s ‑> 'r) ‑> 'r) ‑> finish:('s ‑> 'r) ‑> 'r
val fold_m : bind:('acc_m ‑> f:('acc ‑> 'acc_m) ‑> 'acc_m) ‑> return:('acc ‑> 'acc_m) ‑> 'elt t ‑> init:'acc ‑> f:('acc ‑> 'elt ‑> 'acc_m) ‑> 'acc_m
val iter_m : bind:('unit_m ‑> f:(unit ‑> 'unit_m) ‑> 'unit_m) ‑> return:(unit ‑> 'unit_m) ‑> 'elt t ‑> f:('elt ‑> 'unit_m) ‑> 'unit_m
val to_list_rev : 'a t ‑> 'a list
val of_list : 'a list ‑> 'a t
val of_lazy : 'a t Base.Lazy.t ‑> 'a t
val memoize : 'a t ‑> 'a t
val force_eagerly : 'a t ‑> 'a t
val bounded_length : 'a t ‑> at_most:int ‑> [ `Greater | `Is of int ]
val length_is_bounded_by : ?⁠min:int ‑> ?⁠max:int ‑> 'a t ‑> bool
val merge_all : 'a t list ‑> compare:('a ‑> 'a ‑> int) ‑> 'a t

Merges elements from sequences that are assumed to be sorted by compare to produce a sequence also sorted by compare. If any of the inputs are not sorted, the order of the output is not guaranteed to be sorted.

This includes duplicate elements in the output (whether they occur within one input sequence, or across different input sequences).