NEXT ·
UP ·
PREVIOUS ·
CONTENTS ·
INDEX
Arrays
Lists are the central datatype in applicative programming. In
imperative programming the array is the central datatype. Arrays are
provided in a type-safe way in Standard ML through the use of the
following operations of the Array structure in the
Standard ML library.
- the type 'a Array.array;
- the creation functions Array.array of type (int
* 'a) ->
'a Array.array and
Array.fromList of type
'a list ->
'a Array.array;
- the Array.update operation of type
('a Array.array * int *
'a) -> unit; and
- the operation Array.sub with type ('a
Array.array * int) -> 'a with
exception Subscript. Subscripting begins from 0.
The Array.array type constructor admits equality and the
equality which is provided is equality of reference. Thus, given the
following declarations,
val a = Array.fromList [1];
val b = Array.fromList [1];
then a and b are not equal.
NEXT ·
UP ·
PREVIOUS ·
CONTENTS ·
INDEX