package core_extended

  1. Overview
  2. Docs

Module Appendable_listSource

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.

Sourcetype +'a t
include Sexplib0.Sexpable.S1 with type +'a t := 'a t
Sourceval t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t
Sourceval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
Sourceval empty : _ t
Sourceval of_list : 'a list -> 'a t
Sourceval singleton : 'a -> 'a t
Sourceval append : 'a t -> 'a t -> 'a t
Sourceval concat : 'a t list -> 'a t
Sourceval add_front : 'a -> 'a t -> 'a t
Sourceval add_back : 'a t -> 'a -> 'a t
Sourceval to_sequence : 'a t -> 'a Core.Sequence.t
include Core.Monad.S with type 'a t := 'a t
Sourceval (>>=) : 'a t -> ('a -> 'b t) -> 'b t
Sourceval (>>|) : 'a t -> ('a -> 'b) -> 'b t
module Monad_infix : sig ... end
Sourceval bind : 'a t -> f:('a -> 'b t) -> 'b t
Sourceval return : 'a -> 'a t
Sourceval map : 'a t -> f:('a -> 'b) -> 'b t
Sourceval join : 'a t t -> 'a t
Sourceval ignore_m : 'a t -> unit t
Sourceval all : 'a t list -> 'a list t
Sourceval all_unit : unit t list -> unit t
module Let_syntax : sig ... end
include Core.Container.S1 with type 'a t := 'a t
Sourceval mem : 'a t -> 'a -> equal:('a -> 'a -> bool) -> bool
Sourceval length : 'a t -> int
Sourceval is_empty : 'a t -> bool
Sourceval iter : 'a t -> f:('a -> unit) -> unit
Sourceval fold : 'a t -> init:'acc -> f:('acc -> 'a -> 'acc) -> 'acc
Sourceval fold_result : 'a t -> init:'acc -> f:('acc -> 'a -> ('acc, 'e) Base__.Result.t) -> ('acc, 'e) Base__.Result.t
Sourceval fold_until : 'a t -> init:'acc -> f:('acc -> 'a -> ('acc, 'final) Base__Container_intf.Continue_or_stop.t) -> finish:('acc -> 'final) -> 'final
Sourceval exists : 'a t -> f:('a -> bool) -> bool
Sourceval for_all : 'a t -> f:('a -> bool) -> bool
Sourceval count : 'a t -> f:('a -> bool) -> int
Sourceval sum : (module Base__Container_intf.Summable with type t = 'sum) -> 'a t -> f:('a -> 'sum) -> 'sum
Sourceval find : 'a t -> f:('a -> bool) -> 'a option
Sourceval find_map : 'a t -> f:('a -> 'b option) -> 'b option
Sourceval to_list : 'a t -> 'a list
Sourceval to_array : 'a t -> 'a array
Sourceval min_elt : 'a t -> compare:('a -> 'a -> int) -> 'a option
Sourceval max_elt : 'a t -> compare:('a -> 'a -> int) -> 'a option
Sourcemodule For_testing : sig ... end
Sourcemodule Stable : sig ... end