package stored_reversed

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type +'a t

'a list t represents a list temporarily stored in the reverse of its logical order.

e.g. to represent the sequence 1 then 2 we may store 2 :: 1 :: []

val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
include Ppx_compare_lib.Comparable.S1 with type +'a t := 'a t
val compare : 'a Base__Ppx_compare_lib.compare -> 'a t Base__Ppx_compare_lib.compare
include Ppx_compare_lib.Equal.S1 with type +'a t := 'a t
val equal : 'a Base__Ppx_compare_lib.equal -> 'a t Base__Ppx_compare_lib.equal
val empty : 'a list t

The empty list.

to_list empty == []

val snoc : 'a list t -> 'a -> 'a list t

/O(1)/. Add an item to the logical end of the list.

to_list (snoc xs x) == to_list xs @ [x]

val singleton : 'a -> 'a list t
val of_list : 'a list -> 'a list t

/O(n)/. Convert from a list, preserving the logical order.

val to_list : 'a list t -> 'a list

/O(n)/. Convert to a list, preserving the logical order.

val of_list_rev : 'a list -> 'a list t

/O(1)/ Convert from a list, reversing the logical order.

val to_list_rev : 'a list t -> 'a list

/O(1)/ Convert to a list, reversing the logical order.

val map_to_list : ?tail:'b list -> 'a list t -> f:('a -> 'b) -> 'b list

/O(n)/. Perform a map while converting to a list.

/O(n)/ where /n/ is the length of x.

map_to_list x ~f ~tail:y == List.map (to_list x) ~f @ y

The default ~tail is [].

val map_append : 'b list t -> 'a list -> f:('a -> 'b) -> 'b list t

/O(n)/ Map and append values from a list, preserving logical order.

/O(n)/ where /n/ is the length of y.

map_append x y ~f == List.fold (List.map y ~f) ~init:x ~f:snoc

include Core.Quickcheckable.S1 with type 'a t := 'a t
val quickcheck_generator : 'a Base_quickcheck.Generator.t -> 'a t Base_quickcheck.Generator.t
val quickcheck_observer : 'a Base_quickcheck.Observer.t -> 'a t Base_quickcheck.Observer.t
val quickcheck_shrinker : 'a Base_quickcheck.Shrinker.t -> 'a t Base_quickcheck.Shrinker.t
module Stable : sig ... end
OCaml

Innovation. Community. Security.