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

26.42 トップレベル環境

ライブラリで定義されているよく使う関数はトップレベルで再定義されている. 本説では,Standard ML標準ライブラリで定義されている型や関数の中でトップレベルで 再定義されているものを示す.

  • infix宣言

      infix 7 * / div mod
      infix 6 + - ^
      infixr 5 :: @
      infix 4 = <> > >= < <=
      infix 3 := o
      infix 0 before
    
  • type宣言

      type substring = Substring.substring
      datatype order = datatype General.order
    
  • exception宣言

      exception Bind = General.Bind
      exception Chr= General.Chr
      exception Div= General.Div
      exception Domain= General.Domain
      exception Empty = List.Empty
      exception Fail = General.Fail
      exception Match= General.Match
      exception Overflow= General.Overflow
      exception Size= General.Size
      exception Span= General.Span
      exception Subscript = General.Subscript
      exception Option = Option.Option
      exception Span = General.Span
    
  • val宣言

      val = = <builtin> : [’’a. ’’a * ’’a -> bool]}
      val <> = <builtin> : [’’a. ’’a * ’’a -> bool]}
      val ! = General.!
      val := = General.:=
      val @ = List.@
      val ^ = String.^
      val app = List.app
      val before = General.before
      val ceil = Real.ceil
      val chr = Char.chr
      val concat = String.concat
      val exnMessage = General.exnMessage
      val exnName = General.exnName
      val explode = String.explode
      val floor = Real.floor
      val foldl = List.foldl
      val foldr = List.foldr
      val getOpt = Option.getOpt
      val hd = List.hd
      val ignore = General.ignore
      val implode = String.implode
      val isSome = Option.isSome
      val length = List.length
      val map = List.map
      val not = Bool.not
      val null = List.null
      val o = General.o
      val ord = Char.ord
      val print = TextIO.print
      val real = Real.fromInt
      val rev = List.rev
      val round = Real.round
      val size = String.size
      val str = String.str
      val substring = String.substring
      val tl = List.tl
      val trunc = Real.trunc
      val valOf = Option.valOf
      val vector = Vector.fromList
    

    同値性チェックプリミティブ=<>は,コンパイラが組込み関数として直接 サポートしている.

  • オーバロードされた識別子

      val * : [’a::{int, word, int8, word8, int16, word16, int64, word64, intInf, real, real32}. ’a * ’a -> ’a]
      val + : [’a::{int, word, int8, word8, int16, word16, int64, word64, intInf, real, real32}. ’a * ’a -> ’a]
      val - : [’a::{int, word, int8, word8, int16, word16, int64, word64, intInf, real, real32}. ’a * ’a -> ’a]
      val / : [’a::{real, real32}. ’a * ’a -> ’a]
      val < : [’a::{int, word, int8, word8, int16, word16, int64, word64, intInf, real, real32, string, char}. ’a * ’a -> ’a]
      val <= : [’a::{int, word, int8, word8, int16, word16, int64, word64, intInf, real, real32, string, char}. ’a * ’a -> ’a]
      val > : [’a::{int, word, int8, word8, int16, word16, int64, word64, intInf, real, real32, string, char}. ’a * ’a -> ’a]
      val >= : [’a::{int, word, int8, word8, int16, word16, int64, word64, intInf, real, real32, string, char}. ’a * ’a -> ’a]
      val \ : [’a::{real, real32}. ’a -> ’a]
      val abs : [’a::{int, int8, int16, int64, real, real32}. ’a -> ’a]
      val div : [’a::{int, word, int8, word8, int16, word16, int64, word64, intInf}. ’a * ’a -> ’a]
      val mod : [’a::{int, word, int8, word8, int16, word16, int64, word64, intInf}. ’a * ’a -> ’a]