-
Notifications
You must be signed in to change notification settings - Fork 4
2015 003g Array
John Reppy edited this page Sep 2, 2015
·
1 revision
structure Array : ARRAY
We propose three new functions for the Array
module.
This page is part of proposal 2015-003.
val toList : 'a array -> 'a list
val fromVector : 'a vector -> 'a array
val toVector : 'a array -> 'a vector
toList arr
returns the list of the elements of the array `arr`.
fromVector vec
returns a new array that is initialized to the content of the vector `vec`.
toVector vec
returns a vector of the elements of the array `arr`.
The toVector
function is the same as the existing vector
function, but it
follows the toType
/fromType
naming convention.
The toList
operation complements the existing fromList
and can be implemented more
efficiently than by using List.tabulate
.
Adding the fromVector
and toVector
functions help reduce the friction of converting
between different sequence types.