Module Core_kernel__.List
The interface from Base
include module type of sig ... end
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> intval hash_fold_t : (Base.Hash.state -> 'a -> Base.Hash.state) -> Base.Hash.state -> 'a t -> Base.Hash.stateval t_of_sexp : (Base.Sexp.t -> 'a) -> Base.Sexp.t -> 'a tval sexp_of_t : ('a -> Base.Sexp.t) -> 'a t -> Base.Sexp.tval mem : 'a t -> 'a -> equal:('a -> 'a -> bool) -> boolval length : 'a t -> intval is_empty : 'a t -> boolval iter : 'a t -> f:('a -> unit) -> unitval fold : 'a t -> init:'accum -> f:('accum -> 'a -> 'accum) -> 'accumval fold_result : 'a t -> init:'accum -> f:('accum -> 'a -> ('accum, 'e) Base.Result.t) -> ('accum, 'e) Base.Result.tval fold_until : 'a t -> init:'accum -> f:('accum -> 'a -> ('accum, 'final) Base__.Container_intf.Continue_or_stop.t) -> finish:('accum -> 'final) -> 'finalval exists : 'a t -> f:('a -> bool) -> boolval for_all : 'a t -> f:('a -> bool) -> boolval sum : (module Base__.Container_intf.Summable with type t = 'sum) -> 'a t -> f:('a -> 'sum) -> 'sumval find : 'a t -> f:('a -> bool) -> 'a optionval find_map : 'a t -> f:('a -> 'b option) -> 'b optionval to_list : 'a t -> 'a listval to_array : 'a t -> 'a arrayval min_elt : 'a t -> compare:('a -> 'a -> int) -> 'a optionval max_elt : 'a t -> compare:('a -> 'a -> int) -> 'a optionval invariant : 'a Base__.Invariant_intf.inv -> 'a t Base__.Invariant_intf.invval (>>=) : 'a t -> ('a -> 'b t) -> 'b tval (>>|) : 'a t -> ('a -> 'b) -> 'b t
module Monad_infix = Base__List.Monad_infixval bind : 'a t -> f:('a -> 'b t) -> 'b tval return : 'a -> 'a tval join : 'a t t -> 'a tval ignore_m : 'a t -> unit tval all : 'a t list -> 'a list tval all_unit : unit t list -> unit t
module Let_syntax = Base__List.Let_syntaxval of_list : 'a t -> 'a tval nth : 'a t -> int -> 'a optionval nth_exn : 'a t -> int -> 'aval rev : 'a t -> 'a tval rev_append : 'a t -> 'a t -> 'a tval unordered_append : 'a t -> 'a t -> 'a tval rev_map : 'a t -> f:('a -> 'b) -> 'b tval iter2_exn : 'a t -> 'b t -> f:('a -> 'b -> unit) -> unitval iter2 : 'a t -> 'b t -> f:('a -> 'b -> unit) -> unit Or_unequal_lengths.tval rev_map2_exn : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c tval rev_map2 : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c t Or_unequal_lengths.tval fold2_exn : 'a t -> 'b t -> init:'c -> f:('c -> 'a -> 'b -> 'c) -> 'cval fold2 : 'a t -> 'b t -> init:'c -> f:('c -> 'a -> 'b -> 'c) -> 'c Or_unequal_lengths.tval for_alli : 'a t -> f:(int -> 'a -> bool) -> boolval for_all2_exn : 'a t -> 'b t -> f:('a -> 'b -> bool) -> boolval for_all2 : 'a t -> 'b t -> f:('a -> 'b -> bool) -> bool Or_unequal_lengths.tval existsi : 'a t -> f:(int -> 'a -> bool) -> boolval exists2_exn : 'a t -> 'b t -> f:('a -> 'b -> bool) -> boolval exists2 : 'a t -> 'b t -> f:('a -> 'b -> bool) -> bool Or_unequal_lengths.tval filter : 'a t -> f:('a -> bool) -> 'a tval rev_filter : 'a t -> f:('a -> bool) -> 'a tval filteri : 'a t -> f:(int -> 'a -> bool) -> 'a tval partition_map : 'a t -> f:('a -> [ `Fst of 'b | `Snd of 'c ]) -> 'b t * 'c tval partition3_map : 'a t -> f:('a -> [ `Fst of 'b | `Snd of 'c | `Trd of 'd ]) -> 'b t * 'c t * 'd tval partition_tf : 'a t -> f:('a -> bool) -> 'a t * 'a tval partition_result : ('ok, 'error) Base.Result.t t -> 'ok t * 'error tval split_n : 'a t -> int -> 'a t * 'a tval sort : 'a t -> compare:('a -> 'a -> int) -> 'a tval stable_sort : 'a t -> compare:('a -> 'a -> int) -> 'a tval merge : 'a t -> 'a t -> compare:('a -> 'a -> int) -> 'a tval hd : 'a t -> 'a optionval tl : 'a t -> 'a t optionval hd_exn : 'a t -> 'aval tl_exn : 'a t -> 'a tval findi : 'a t -> f:(int -> 'a -> bool) -> (int * 'a) optionval find_exn : 'a t -> f:('a -> bool) -> 'aval find_map_exn : 'a t -> f:('a -> 'b option) -> 'bval find_mapi : 'a t -> f:(int -> 'a -> 'b option) -> 'b optionval find_mapi_exn : 'a t -> f:(int -> 'a -> 'b option) -> 'bval append : 'a t -> 'a t -> 'a tval map : 'a t -> f:('a -> 'b) -> 'b tval folding_map : 'a t -> init:'b -> f:('b -> 'a -> 'b * 'c) -> 'c tval folding_mapi : 'a t -> init:'b -> f:(int -> 'b -> 'a -> 'b * 'c) -> 'c tval fold_map : 'a t -> init:'b -> f:('b -> 'a -> 'b * 'c) -> 'b * 'c tval fold_mapi : 'a t -> init:'b -> f:(int -> 'b -> 'a -> 'b * 'c) -> 'b * 'c tval concat_map : 'a t -> f:('a -> 'b t) -> 'b tval concat_mapi : 'a t -> f:(int -> 'a -> 'b t) -> 'b tval map2_exn : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c tval map2 : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c t Or_unequal_lengths.tval rev_map3_exn : 'a t -> 'b t -> 'c t -> f:('a -> 'b -> 'c -> 'd) -> 'd tval rev_map3 : 'a t -> 'b t -> 'c t -> f:('a -> 'b -> 'c -> 'd) -> 'd t Or_unequal_lengths.tval map3_exn : 'a t -> 'b t -> 'c t -> f:('a -> 'b -> 'c -> 'd) -> 'd tval map3 : 'a t -> 'b t -> 'c t -> f:('a -> 'b -> 'c -> 'd) -> 'd t Or_unequal_lengths.tval rev_map_append : 'a t -> 'b t -> f:('a -> 'b) -> 'b tval fold_right : 'a t -> f:('a -> 'b -> 'b) -> init:'b -> 'bval fold_left : 'a t -> init:'b -> f:('b -> 'a -> 'b) -> 'bval unzip : ('a * 'b) t -> 'a t * 'b tval unzip3 : ('a * 'b * 'c) t -> 'a t * 'b t * 'c tval zip : 'a t -> 'b t -> ('a * 'b) t Or_unequal_lengths.tval zip_exn : 'a t -> 'b t -> ('a * 'b) tval mapi : 'a t -> f:(int -> 'a -> 'b) -> 'b tval rev_mapi : 'a t -> f:(int -> 'a -> 'b) -> 'b tval iteri : 'a t -> f:(int -> 'a -> unit) -> unitval foldi : 'a t -> init:'b -> f:(int -> 'b -> 'a -> 'b) -> 'bval reduce_exn : 'a t -> f:('a -> 'a -> 'a) -> 'aval reduce : 'a t -> f:('a -> 'a -> 'a) -> 'a optionval reduce_balanced : 'a t -> f:('a -> 'a -> 'a) -> 'a optionval reduce_balanced_exn : 'a t -> f:('a -> 'a -> 'a) -> 'aval group : 'a t -> break:('a -> 'a -> bool) -> 'a t tval groupi : 'a t -> break:(int -> 'a -> 'a -> bool) -> 'a t tval chunks_of : 'a t -> length:int -> 'a t tval last : 'a t -> 'a optionval last_exn : 'a t -> 'aval is_prefix : 'a t -> prefix:'a t -> equal:('a -> 'a -> bool) -> boolval find_consecutive_duplicate : 'a t -> equal:('a -> 'a -> bool) -> ('a * 'a) optionval remove_consecutive_duplicates : ?which_to_keep:[ `First | `Last ] -> 'a t -> equal:('a -> 'a -> bool) -> 'a tval dedup_and_sort : compare:('a -> 'a -> int) -> 'a t -> 'a tval find_a_dup : compare:('a -> 'a -> int) -> 'a t -> 'a optionval contains_dup : compare:('a -> 'a -> int) -> 'a t -> boolval find_all_dups : compare:('a -> 'a -> int) -> 'a t -> 'a listval count : 'a t -> f:('a -> bool) -> intval counti : 'a t -> f:(int -> 'a -> bool) -> intval range : ?stride:int -> ?start:[ `exclusive | `inclusive ] -> ?stop:[ `exclusive | `inclusive ] -> int -> int -> int tval range' : compare:('a -> 'a -> int) -> stride:('a -> 'a) -> ?start:[ `exclusive | `inclusive ] -> ?stop:[ `exclusive | `inclusive ] -> 'a -> 'a -> 'a tval init : int -> f:(int -> 'a) -> 'a tval rev_filter_map : 'a t -> f:('a -> 'b option) -> 'b tval rev_filter_mapi : 'a t -> f:(int -> 'a -> 'b option) -> 'b tval filter_map : 'a t -> f:('a -> 'b option) -> 'b tval filter_mapi : 'a t -> f:(int -> 'a -> 'b option) -> 'b tval filter_opt : 'a option t -> 'a t
module Assoc = Base__List.Assocval sub : 'a t -> pos:int -> len:int -> 'a tval take : 'a t -> int -> 'a tval drop : 'a t -> int -> 'a tval take_while : 'a t -> f:('a -> bool) -> 'a tval drop_while : 'a t -> f:('a -> bool) -> 'a tval split_while : 'a t -> f:('a -> bool) -> 'a t * 'a tval drop_last : 'a t -> 'a t optionval drop_last_exn : 'a t -> 'a tval concat : 'a t t -> 'a tval concat_no_order : 'a t t -> 'a tval cons : 'a -> 'a t -> 'a tval cartesian_product : 'a t -> 'b t -> ('a * 'b) tval permute : ?random_state:Base.Random.State.t -> 'a t -> 'a tval random_element : ?random_state:Base.Random.State.t -> 'a t -> 'a optionval random_element_exn : ?random_state:Base.Random.State.t -> 'a t -> 'aval is_sorted : 'a t -> compare:('a -> 'a -> int) -> boolval is_sorted_strictly : 'a t -> compare:('a -> 'a -> int) -> boolval equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
module Infix = Base__List.Infixtype 'a t= 'a Core_kernel__.Import.list
include Bin_prot.Binable.S1 with type 'a t := 'a t
val bin_shape_t : Bin_prot.Shape.t -> Bin_prot.Shape.tval bin_size_t : ('a, 'a t) Bin_prot.Size.sizer1val bin_write_t : ('a, 'a t) Bin_prot.Write.writer1val bin_read_t : ('a, 'a t) Bin_prot.Read.reader1val __bin_read_t__ : ('a, int -> 'a t) Bin_prot.Read.reader1val bin_writer_t : ('a, 'a t) Bin_prot.Type_class.S1.writerval bin_reader_t : ('a, 'a t) Bin_prot.Type_class.S1.readerval bin_t : ('a, 'a t) Bin_prot.Type_class.S1.t
include Typerep_lib.Typerepable.S1 with type 'a t := 'a t
val typerep_of_t : 'a Typerep_lib.Std_internal.Typerep.t -> 'a t Typerep_lib.Std_internal.Typerep.tval typename_of_t : 'a Typerep_lib.Typename.t -> 'a t Typerep_lib.Typename.t
module Assoc : sig ... endExtensions
val stable_dedup : 'a t -> 'a tstable_dedupSame asdedupbut maintains the order of the list and doesn't allow compare function to be specified (otherwise, the implementation in terms of Set.t would hide a heavyweight functor instantiation at each call).
val stable_dedup_staged : compare:('a -> 'a -> Core_kernel__.Import.int) -> ('a Core_kernel__.Import.list -> 'a Core_kernel__.Import.list) Core_kernel__.Import.Staged.t
exceptionDuplicate_found of Core_kernel__.Import.unit -> Base.Sexp.t * Core_kernel__.Import.stringOnly raised in
exn_if_dupbelow.
val exn_if_dup : compare:('a -> 'a -> Core_kernel__.Import.int) -> ?context:Core_kernel__.Import.string -> 'a t -> to_sexp:('a -> Base.Sexp.t) -> Core_kernel__.Import.unitexn_if_dup ~compare ?context t ~to_sexpraises iftcontains a duplicate. It will specifically raise aDuplicate_foundexception and usecontextas its second argument. O(n log n) time complexity.
val slice : 'a t -> Core_kernel__.Import.int -> Core_kernel__.Import.int -> 'a tslice t start stopreturns a new list including elementst.(start)throught.(stop-1), normalized Python-style with the exception thatstop = 0is treated asstop = length t.
include Core_kernel.Comparator.Derived with type 'a t := 'a t
val comparator : ('a, 'cmp) Core_kernel.Comparator.comparator -> ('a t, 'cmp comparator_witness) Core_kernel.Comparator.comparator
include Core_kernel.Quickcheckable.S1 with type 'a t := 'a t
val quickcheck_generator : 'a Base_quickcheck.Generator.t -> 'a t Base_quickcheck.Generator.tval quickcheck_observer : 'a Base_quickcheck.Observer.t -> 'a t Base_quickcheck.Observer.tval quickcheck_shrinker : 'a Base_quickcheck.Shrinker.t -> 'a t Base_quickcheck.Shrinker.t
val to_string : f:('a -> Core_kernel__.Import.string) -> 'a t -> Core_kernel__.Import.stringval gen_non_empty : 'a Core_kernel.Quickcheck.Generator.t -> 'a t Core_kernel.Quickcheck.Generator.tLike
gen, but never generates the empty list.
val gen_with_length : Core_kernel__.Import.int -> 'a Core_kernel.Quickcheck.Generator.t -> 'a t Core_kernel.Quickcheck.Generator.tLike
gen, but generates lists with the given length.
val gen_filtered : 'a t -> 'a t Core_kernel.Quickcheck.Generator.tRandomly drops elements from the input list. Length is chosen uniformly between 0 and the length of the input, inclusive.
val gen_permutations : 'a t -> 'a t Core_kernel.Quickcheck.Generator.tgen_permutations tgenerates all permutations oflist. Iftcontains duplicate values, thengen_permutations twill produce duplicate lists.
val zip_with_remainder : 'a Core_kernel__.Import.list -> 'b Core_kernel__.Import.list -> ('a * 'b) Core_kernel__.Import.list * ('a Core_kernel__.Import.list, 'b Core_kernel__.Import.list) Core_kernel.Either.t Core_kernel__.Import.optionzip_with_remainder xs yszips as many elements as possible ofxsandystogether and also returns the un-zipped remainder of the longer input, if the inputs have different lengths.If
xsandyshave the same length,zip_with_remainder xs ysreturns the same thing as(zip_exn xs ys, None)
module Stable : sig ... end