SML# Document Version 3.7.1
26 Standard ML Basis Library

26.21 MONO_VECTOR_SLICE

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

signature MONO_VECTOR_SLICE =
sig
  type elem
  type slice
  type vector
  val all : (elem -> bool) -> slice -> bool
  val app : (elem -> unit) -> slice -> unit
  val appi : (int * elem -> unit) -> slice -> unit
  val base : slice -> vector * int * int
  val collate : (elem * elem -> order) -> slice * slice -> order
  val concat : slice list -> vector
  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 : vector -> slice
  val getItem : slice -> (elem * slice) option
  val isEmpty : slice -> bool
  val length : slice -> int
  val map : (elem -> elem) -> slice -> vector
  val mapi : (int * elem -> elem) -> slice -> vector
  val slice : vector * int * int option -> slice
  val sub : slice * int -> elem
  val subslice : slice * int * int option -> slice
  val vector : slice -> vector
end

Structures that implement the signature

  • CharVectorSlice :> MONO_VECTOR_SLICE

    type elem = char
    type slice (= boxed)
    type vector = string

  • Word8VectorSlice :> MONO_VECTOR_SLICE

    type elem = word8
    type slice (= boxed)
    type vector = word8 vector