SML# Document Version 3.7.1
26 Standard ML Basis Library

26.19 MONO_ARRAY_SLICE

Provide primitives for manipulating slices (sub-arrays) of monomorpic arrays.

signature MONO_ARRAY_SLICE =
sig
  type array
  type elem
  type slice
  type vector
  type vector_slice
  val all : (elem -> bool) -> slice -> bool
  val app : (elem -> unit) -> slice -> unit
  val appi : (int * elem -> unit) -> slice -> unit
  val base : slice -> array * int * int
  val collate : (elem * elem -> order) -> slice * slice -> order
  val copy : {src : slice, dst : array, di : int} -> unit
  val copyVec : {src : vector_slice, dst : array, di : int} -> unit
  val exists : (elem -> bool) -> slice -> bool
  val find : (elem -> bool) -> slice -> elem option
  val findi : (int * elem -> bool) -> slice -> (int * elem) option
  val foldl : (elem * ’b -> ’b) -> ’b -> slice -> ’b
  val foldli : (int * elem * ’b -> ’b) -> ’b -> slice -> ’b
  val foldr : (elem * ’b -> ’b) -> ’b -> slice -> ’b
  val foldri : (int * elem * ’b -> ’b) -> ’b -> slice -> ’b
  val full : array -> slice
  val getItem : slice -> (elem * slice) option
  val isEmpty : slice -> bool
  val length : slice -> int
  val modify : (elem -> elem) -> slice -> unit
  val modifyi : (int * elem -> elem) -> slice -> unit
  val slice : array * int * int option -> slice
  val sub : slice * int -> elem
  val subslice : slice * int * int option -> slice
  val update : slice * int * elem -> unit
  val vector : slice -> vector
end

Structures that implement the signature

  • CharArraySlice :> MONO_ARRAY_SLICE

    type array = char array
    type elem = char
    type slice (= boxed)
    type vector = string
    type vector_slice = CharVectorSlice.slice

  • Word8ArraySlice :> MONO_ARRAY_SLICE

    type array = word8 array
    type elem = word8
    type slice (= boxed)
    type vector = word8 vector
    type vector_slice = Word8VectorSlice.slice