This section describes the top-level environment, i.e. all items that are available unqualified. It extends the Standard ML Basis' top-level environment.
Imported implicitly.
The following table presents the top-level types and their defining structures. Items marked (*) are extensions to the Standard Basis.
| type unit = {} | General.unit | |
| eqtype int | Int.t | |
| eqtype word | Word.t | |
| eqtype real | Real.t | |
| eqtype char | Char.t | |
| eqtype string | String.t | |
| eqtype substring | Substring.t | |
| exttype exn | Exn.t | |
| eqtype 'a vector | Vector.t | |
| eqtype 'a array | Array.t | |
| datatype 'a ref = ref of 'a | Ref.t | |
| datatype bool = false | true | Bool.t | |
| datatype order = LESS | EQUAL | GREATER | General.order | |
| datatype 'a option = NONE | SOME of 'a | Option.t | |
| datatype 'a list = nil | op:: of 'a * 'a list | List.t | |
| datatype ('a,'b) alt = FST of 'a | SND of 'b | Alt.t | (*) |
| type ('a,'b) pair = 'a * 'b | Pair.t | (*) |
| type package | Package.t | (*) |
The global exceptions are the following:
| exception Alt | Alt.Alt | (*) |
| exception Assert of string * int | General.Assert | (*) |
| exception Bind | General.Bind | |
| exception Chr | General.Chr | |
| exception Div | General.Div | |
| exception Domain | General.Domain | |
| exception Empty | List.Empty | |
| exception Fail of string | General.Fail | |
| exception Match | General.Match | |
| exception Option | Option.Option | |
| exception Overflow | General.Overflow | |
| exception Size | General.Size | |
| exception Span | General.Span | |
| exception Subscript | General.Subscript | |
| exception Unordered | General.Unordered | (*) |
The next table presents all non-overloaded functions:
| val = : ''a * ''a -> ''a | primitive | |
| val <> : ''a * ''a -> ''a | primitive | |
| val real : int -> real | Real.fromInt | |
| val ceil : real -> int | Real.ceil | |
| val floor : real -> int | Real.floor | |
| val trunc : real -> int | Real.trunc | |
| val round : real -> int | Real.round | |
| val ord : char -> int | Char.ord | |
| val chr : int -> char | Char.chr | |
| val str : char -> string | String.str | |
| val size : char -> int | String.size | |
| val ^ : string * string -> string | String.^ | |
| val concat : string list -> string | String.concat | |
| val explode : string -> char list | String.explode | |
| val implode : char list -> string | String.implode | |
| val substring : string * int * int -> string | String.substring | |
| val vector : 'a list -> 'a vector | Vector.fromList | |
| val await : 'a -> 'a | Future.await | (*) |
| val ! : 'a ref -> 'a | Ref.! | |
| val := : 'a ref * 'a -> unit | Ref.:= | |
| val :=: : 'a ref * 'a ref -> unit | Ref.:=: | (*) |
| val exnName : exn -> string | General.exnName | |
| val exnMessage : exn -> string | General.exnName | |
| val not : bool -> bool | Bool.not | |
| val inverse : order -> order | General.inverse | (*) |
| val isSome : 'a option -> bool | Option.isSome | |
| val isNone : 'a option -> bool | Option.isNone | (*) |
| val valOf : 'a option -> 'a | Option.valOf | |
| val getOpt : 'a option * 'a -> 'a | Option.getOpt | |
| val isFst : ('a,'b) alt -> bool | Alt.isFst | (*) |
| val isSnd : ('a,'b) alt -> bool | Alt.isSnd | (*) |
| val null : 'a list -> bool | List.null | |
| val hd : 'a list -> 'a | List.hd | |
| val tl : 'a list -> 'a list | List.tl | |
| val length : 'a list -> int | List.length | |
| val rev : 'a list -> 'a list | List.rev | |
| val @ : 'a list * 'a list -> 'a list | List.@ | |
| val app : ('a -> unit) -> 'a list -> unit | List.app | |
| val appr : ('a -> unit) -> 'a list -> unit | List.appr | (*) |
| val map : ('a -> 'b) -> 'a list -> 'b list | List.map | |
| val foldl : ('a * 'b -> 'b) -> 'b -> 'a list -> 'b | List.foldl | |
| val foldr : ('a * 'b -> 'b) -> 'b -> 'a list -> 'b | List.foldr | |
| val ignore : 'a -> unit | General.ignore | |
| val before : 'a * unit -> 'a | General.before | |
| val o : ('a -> 'b) -> ('c -> 'a) -> ('c -> 'b) | General.o |
The following functions are only available in the interactive toplevel:
| val exit : 'a -> unit | primitive | (*) |
| val inspect : 'a -> unit | Inspector.inspect | (*) |
| val printVal : 'a -> unit | Print.printVal | (*) |
| val use : string -> unit | primitive |
Note that the use function can operate on URLs, not just local file names.
All arithmetic functions are overloaded:
| val ~ : num -> num |
| val abs : num -> num |
| val + : num * num -> num |
| val - : num * num -> num |
| val * : num * num -> num |
| val div : wordint * wordint -> wordint |
| val mod : wordint * wordint -> wordint |
| val / : real * real -> real |
| val < : numtext * numtext -> bool |
| val > : numtext * numtext -> bool |
| val <= : numtext * numtext -> bool |
| val >= : numtext * numtext -> bool |
The initial infix declarations are as follows:
infix 7 * / div mod
infix 6 + - ^
infixr 5 :: @
infix 4 = <> > >= < <=
infix 3 := :=: o
infix 0 before