annotate lib/growvect.mli @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
rev   line source
mike@0 1 (* growvect.mli *)
mike@0 2 (* Copyright (c) 2017 J. M. Spivey *)
mike@0 3
mike@0 4 (* This module provides an alternative implementation of arrays that
mike@0 5 grow as needed to accommodate the indices used in assignments. *)
mike@0 6
mike@0 7 type 'a t
mike@0 8
mike@0 9 (* create -- make an empty vector with a specified initial capacity *)
mike@0 10 val create : int -> 'a t
mike@0 11
mike@0 12 (* make -- make a vector of specified size *)
mike@0 13 val make : int -> 'a -> 'a t
mike@0 14
mike@0 15 (* clear -- make vector empty again *)
mike@0 16 val clear : 'a t -> unit
mike@0 17
mike@0 18 (* get -- fetch element at given index *)
mike@0 19 val get : 'a t -> int -> 'a
mike@0 20
mike@0 21 (* size -- get current number of elements *)
mike@0 22 val size : 'a t -> int
mike@0 23
mike@0 24 (* set -- change existing element at given index *)
mike@0 25 val set : 'a t -> int -> 'a -> unit
mike@0 26
mike@0 27 (* append -- add new element at the end *)
mike@0 28 val append : 'a t -> 'a -> unit
mike@0 29
mike@0 30 (* to_list -- convert to list *)
mike@0 31 val to_list : 'a t -> 'a list
mike@0 32
mike@0 33 (* iter -- apply function to each element *)
mike@0 34 val iter : ('a -> unit) -> 'a t -> unit