Module Metapp.AccuSource

Indexed accumulator to build an array.

Sourcetype 'a t

An accumulator of type 'a t can accumulate values of type 'a to build an 'a array.

Sourceval empty : 'a t

The empty accumulator.

Sourceval add : 'a -> 'a t -> int * 'a t

add v a returns (i, a') where a' is the accumulator a followed by the value v. i is the index of v in a' (and is equal to the length of a).

Sourceval length : 'a t -> int

length a returns the length of the accumulator a (the number of elements).

Sourceval to_array : 'a t -> 'a array

to_array a returns the array containing all the elements of a.