プログラミング言語SML#解説 3.7.1版
26 Standard ML標準ライブラリ

26.19 MONO_ARRAY_SLICE

単相型配列の部分配列の操作関数を提供.

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

シグネチャを実装するストラクチャ

  • 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