You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val toList : 'a vector -> 'a list
val append : 'a vector * 'a -> 'a vector
val prepend : 'a * 'a vector -> 'a vector
Description
toList vec
returns the list of the elements in the vector `vec`.
append (vec, x)
returns the vector formed by adding the element `x` to the end of the vector `vec`.
Will raise the `Size` exception if the resulting vector would exceed `maxLen` elements.
prepend (x, vec)
returns the vector formed by adding the element `x` to the beginning of the vector `vec`.
Will raise the `Size` exception if the resulting vector would exceed `maxLen` elements.
Rationale
The toList operation complements the existing fromList and can be implemented more
efficiently than by using List.tabulate. Adding it helps reduce the friction of
converting between the different sequence types.
The append and prepend operations provide a convinent (and slightly more efficient)
way to grow a vector by one element, although they are still O(n) operations.