package acgtk

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

Module PersistentArray.PersistentArraySource

Sourcetype 'a t

The type of the data structure

Sourceexception Unaccessible

This exception is raised in case a persistent array a_0 has been modified several times, yielding arrays a_1, a_2, ... , a_N, and that a_i is accessed using the get or set functions (with 0 <= i < N) when one tries to access a_j with i < j <= N.

Sourceexception Store_Not_found
Sourceexception Not_found
Sourceval init : int -> (int -> 'a) -> 'a t

init n f returns a persistent array a of length n such that for all i. a.(i) is set to f i. Note that addressing starts at 1

Sourceval make : int -> 'a -> 'a t

make n d returns a persistent array a of length n with d content for all i. Note that addressing starts at 1

Sourceval of_list_rev : 'a list -> 'a t

of_list_rev l returns a persistent array of size the length pf l and containing its elements in the reverse order

Sourceval get : int -> 'a t -> 'a

get i t returns the value stored in t at address i starting at 1.

Sourceval set : int -> 'a -> 'a t -> 'a t

set i v t returns a new persistent array t' equal to t except that t'.(i)=v.

Sourceval length : 'a t -> int

length t returns the length of t.

Sourceval print : ('a -> string) -> 'a t -> unit

print f t prints the content of t without rerooting it (so the same arrays remain accessible.

Sourceval print_and_reroot : ('a -> string) -> 'a t -> unit

print_and_reroot f t prints the content of t and reroots it, so any further modifier version of this array becomes unaccessible.

copy t returns a copy of t, that is, a fresh array containing the same elements as t. t is unchanged.

Sourceval copy : 'a t -> 'a t
OCaml

Innovation. Community. Security.