module InfiniteArray: sig .. end
type t('a);
This module implements infinite arrays. *
let make: 'a => t('a);
make x
creates an infinite array, where every slot contains x
. *
let get: (t('a), int) => 'a;
get a i
returns the element contained at offset i
in the array a
.
Slots are numbered 0 and up. *
let set: (t('a), int, 'a) => unit;
set a i x
sets the element contained at offset i
in the array
a
to x
. Slots are numbered 0 and up. *
let extent: t('a) => int;
extent a
is the length of an initial segment of the array a
that is sufficiently large to contain all set
operations ever
performed. In other words, all elements beyond that segment have
the default value.
let domain: t('a) => array('a);
domain a
is a fresh copy of an initial segment of the array a
whose length is extent a
.