package lrgrep

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Indexing.VectorSource

The submodule Vector allows safely manipulating indices into a vector.

Sourcetype ('n, 'a) t = ('n, 'a) vector
Sourceval length : ('n, 'a) t -> 'n cardinal

length is analogous to Array.length, but returns a cardinal instead of an ordinary integer.

Sourceval length_as_int : ('n, 'a) t -> int
Sourceval get : ('n, 'a) t -> 'n index -> 'a

get is Array.get, but expects an index instead of an ordinary integer. This guarantees that the index is within bounds.

Sourceval set : ('n, 'a) t -> 'n index -> 'a -> unit

set is Array.set, but expects an index instead of an ordinary integer. This guarantees that the index is within bounds.

Sourceval set_cons : ('n, 'a list) t -> 'n index -> 'a -> unit

set_cons t i x is short for set t i (x :: get t i).

Sourceval empty : (Empty.n, _) t

empty is the empty vector.

Sourceval make : 'n cardinal -> 'a -> ('n, 'a) t

make is analogous to Array.make. Invoking make n x fixes the cardinal n.

Sourceval make' : 'n cardinal -> (unit -> 'a) -> ('n, 'a) t

make' n f is roughly analogous to make n (f()), but removes the need to exhibit a value of type 'a when n is zero. The function call f() takes place only if n is greater than zero. It takes place at most once. Invoking make' n f fixes the cardinal n.

Sourceval init : 'n cardinal -> ('n index -> 'a) -> ('n, 'a) t

init is analogous to Array.init. Invoking init n f fixes the cardinal n.

Sourceval map : ('a -> 'b) -> ('n, 'a) t -> ('n, 'b) t

map is analogous to Array.map.

Sourceval copy : ('n, 'a) t -> ('n, 'a) t
Sourceval mapi : ('n index -> 'a -> 'b) -> ('n, 'a) t -> ('n, 'b) t
Sourceval for_all : ('a -> bool) -> ('n, 'a) t -> bool
Sourceval exists : ('a -> bool) -> ('n, 'a) t -> bool
Sourceval iter : ('a -> unit) -> ('n, 'a) t -> unit
Sourceval iteri : ('n index -> 'a -> unit) -> ('n, 'a) t -> unit
Sourceval iter2 : ('a -> 'b -> unit) -> ('n, 'a) t -> ('n, 'b) t -> unit
Sourceval rev_iteri : ('n index -> 'a -> unit) -> ('n, 'a) t -> unit
Sourceval fold_left : ('a -> 'b -> 'a) -> 'a -> (_, 'b) t -> 'a
Sourceval fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> ('n, 'b) t -> ('n, 'c) t -> 'a
Sourceval fold_lefti : ('a -> 'n index -> 'b -> 'a) -> 'a -> ('n, 'b) t -> 'a
Sourceval fold_lefti2 : ('a -> 'n index -> 'b -> 'c -> 'a) -> 'a -> ('n, 'b) t -> ('n, 'c) t -> 'a
Sourceval fold_right : ('b -> 'a -> 'a) -> (_, 'b) t -> 'a -> 'a
Sourceval fold_right2 : ('b -> 'c -> 'a -> 'a) -> ('n, 'b) t -> ('n, 'c) t -> 'a -> 'a
Sourceval fold_righti : ('n index -> 'b -> 'a -> 'a) -> ('n, 'b) t -> 'a -> 'a
Sourceval fold_righti2 : ('n index -> 'b -> 'c -> 'a -> 'a) -> ('n, 'b) t -> ('n, 'c) t -> 'a -> 'a
Sourceval cast_array : 'n cardinal -> 'a array -> ('n, 'a) t
Sourceval as_array : (_, 'a) t -> 'a array
Sourceval to_list : (_, 'a) t -> 'a list
Sourcetype 'a packed =
  1. | Packed : (_, 'a) vector -> 'a packed
Sourceval of_array : 'a array -> 'a packed
Sourceval of_list : 'a list -> 'a packed
Sourcemodule type V = sig ... end
Sourcemodule Of_array (A : sig ... end) : V with type a = A.a
Sourceval equal : ('a -> 'a -> bool) -> ('n, 'a) t -> ('n, 'a) t -> bool
Sourceval compare : ('a -> 'a -> int) -> ('n, 'a) t -> ('n, 'a) t -> int