Abstract
Types representing slices of arrays.
This module defines various module types and modules for working with slices of arrays at different levels of granularity. None of the functionality here is particularly advanced or difficult to implement, but it is useful as a common interface for other containers.
Synopsis
Description
- ↑module type slice
An array slice represents a contiguous interval of some array. Essentially, a slice is an offset and a length. The slice does not contain a reference to the array in question. This is mostly useful for working with arrays of slices, as this would otherwise lead to irregular arrays-of-arrays.
- ↑type slice 'a
An array slice. The
aparameter is merely a phantom type.- ↑val mk 'a: (i: i64) -> (n: i64) -> slice a
Construct an array slice from an offset and a length.
- ↑val unmk 'a: slice a -> (i64, i64)
Deconstruct array slice into offset and length. The following property holds:
unmk (mk i n) == (i,n)- ↑val get [n] 'a: slice a -> [n]a -> ?[k].[k]a
Retrieve the elements corresponding to some slice of an array. This may fail if the slide is out-of-bounds.
- ↑module mk_slice_key
Create a
keyfor slices of some specific element type. The element type must also be provided with akeymodule for which the context is unit.