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

26.21 MONO_VECTOR_SLICE

単相型ベクトルの部分ベクトルの操作関数を提供.

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

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

  • 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