package acgtk

  1. Overview
  2. Docs
type 'a t

The type of the data structure

exception 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.

exception Store_Not_found
exception Not_found
val 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

val 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

val 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

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

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

val 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.

val length : 'a t -> int

length t returns the length of t.

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

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

val 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.

val copy : 'a t -> 'a t