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 Array.array type constructor admits equality and the
equality which is provided is equality of reference. Thus, given the
- the type 'a Array.array;
- the creation functions Array.array of type (int
* 'a) ->
'a Array.array and
Array.fromList of type
'a list ->
- 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.
val a = Array.fromList ;
val b = Array.fromList ;
then a and b are not equal.