Skip to content

2015 003m MONO_ARRAY_SLICE

John Reppy edited this page Jul 9, 2023 · 1 revision
signature MONO_ARRAY_SLICE

We propose two new functions for the MONO_ARRAY signature to track the changes made to the ArraySlice module.

This page is part of proposal 2015-003.


Synopsis

val toList     : slice -> elem list
val toVector   : slice -> vector

Description

  • toList arr

returns the list of the elements of the array `arr`.
  • toVector vec

returns a vector of the elements of the array `arr`.

Discussion

The toVector function is the same as the existing vector function, but it follows the toType/fromType naming convention.

Rationale

The toList operation complements the existing fromList and can be implemented more efficiently than by using List.tabulate. These additions track the changes to the ArraySlice structure.