package core_extended

  1. Overview
  2. Docs

A polymorphic data structure parametrized by 'a to represent lists of elements of 'a while supporting constant time append operations.

One example of use is to manipulate a decorated text represented as a sequence of words. Eventually we are interested in producing the concatenation of all the word in some form, but we do not want to pay the allocation costs of buildings intermediate string concatenations.

This module is a generalization of the Rope module. Essentially: type Rope.t = string Appendable_list.t

The following operations all run in constant time: empty, of_list, singleton, append, concat, add_front, add_back

to_sequence builds a sequence where access to the next element has an amortized constant time.

All traversal operations such as iter and fold are tail recursive.

The monad exported by the module is semantically the same as the one in List. That is: bind t f applies f to each element of t and append the resulting list respecting the order in which the elements appear in t.

type +'a t
include Ppx_sexp_conv_lib.Sexpable.S1 with type +'a t := 'a t
val t_of_sexp : (Sexplib0__.Sexp.t -> 'a) -> Sexplib0__.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib0__.Sexp.t) -> 'a t -> Sexplib0__.Sexp.t
val empty : _ t
val of_list : 'a list -> 'a t
val singleton : 'a -> 'a t
val append : 'a t -> 'a t -> 'a t
val concat : 'a t list -> 'a t
val add_front : 'a -> 'a t -> 'a t
val add_back : 'a t -> 'a -> 'a t
val to_sequence : 'a t -> 'a Core_kernel.Sequence.t
include Core_kernel.Monad.S with type 'a t := 'a t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val (>>|) : 'a t -> ('a -> 'b) -> 'b t
module Monad_infix : sig ... end
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
module Let_syntax : sig ... end
include Core_kernel.Container.S1 with type 'a t := '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, 'e) Base__.Result.t) -> ('accum, 'e) Base__.Result.t
val fold_until : 'a t -> init:'accum -> f:('accum -> 'a -> ('accum, 'final) Base__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__Container_intf.Summable 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
module For_testing : sig ... end
OCaml

Innovation. Community. Security.