Skip to content

2015 003f MONO_VECTOR

John Reppy edited this page Sep 2, 2015 · 1 revision
signature MONO_VECTOR

We propose three new functions for the MONO_VECTOR signature to track the changes to the Vector structure.

This page is part of proposal 2015-003.


Synopsis

val toList  : vector -> elem list

val append  : vector * elem -> vector
val prepend : elem * vector -> vector

Description

  • toList vec

returns the list of the elements of the vector `vec`. Will raise the `Size` exception if the resulting vector would exceed `maxLen` elements.
  • 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

These additions track the changes to the Vector structure.