Enum BuiltIn

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static interface  BuiltIn.DataTypeHelper
      Callback used when defining a datatype.
      static class  BuiltIn.Structure
      Built-in structure.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ABS
      Function "abs", of type "int → int".
      FALSE
      Literal "false", of type "bool".
      GENERAL_OP_O
      Operator "General.op o", of type "(β → γ) * (α → β) → α → γ"
      IGNORE
      Function "General.ignore", of type "α → unit".
      INTERACT_USE
      Function "Interact.use" of type "string → unit"
      LIST_ALL
      Function "List.all", of type "(α → bool) → α list → bool".
      LIST_APP
      Function "List.app", of type "(α → unit) → α list → unit".
      LIST_AT
      Function "List.at", of type "α list * α list → α list".
      LIST_COLLATE
      Function "List.collate", of type "(α * α → order) → α list * α list → order".
      LIST_CONCAT
      Function "List.concat", of type "α list list → α list".
      LIST_DROP
      Function "List.drop", of type "α list * int → α list".
      LIST_EXISTS
      Function "List.exists", of type "(α → bool) → α list → bool".
      LIST_FILTER
      Function "List.filter", of type "(α → bool) → α list → α list".
      LIST_FIND
      Function "List.find", of type "(α → bool) → α list → α option".
      LIST_FOLDL
      Function "List.foldl", of type "(α * β → β) → β → α list → β".
      LIST_FOLDR
      Function "List.foldr", of type "(α * β → β) → β → α list → β".
      LIST_GET_ITEM
      Function "List.getItem", of type "α list → (α * α list) option".
      LIST_HD
      Function "List.hd", of type "α list → α".
      LIST_LAST
      Function "List.last", of type "α list → α".
      LIST_LENGTH
      Function "List.length", of type "α list → int".
      LIST_MAP
      Function "List.map", of type "(α → β) → α list → β list".
      LIST_MAP_PARTIAL
      Function "List.mapPartial", of type "(α → β option) → α list → β list".
      LIST_NIL
      Constant "List.nil", of type "α list".
      LIST_NTH
      Function "List.nth", of type "α list * int → α".
      LIST_NULL
      Function "List.null", of type "α list → bool".
      LIST_OP_AT
      Operator "List.op @", of type "α list * α list → α list".
      LIST_PARTITION
      Function "List.partition", of type "(α → bool) → α list → α list * α list".
      LIST_REV
      Function "List.rev", of type "α list → α list".
      LIST_REV_APPEND
      Function "List.revAppend", of type "α list * α list → α list".
      LIST_TABULATE
      Function "List.tabulate", of type "int * (int → α) → α list".
      LIST_TAKE
      Function "List.take", of type "α list * int → α list".
      LIST_TL
      Function "List.tl", of type "α list → α list".
      MATH_ACOS
      Function "Math.acos", of type "real → real".
      MATH_ASIN
      Function "Math.asin", of type "real → real".
      MATH_ATAN
      Function "Math.atan", of type "real → real".
      MATH_ATAN2
      Function "Math.atan2", of type "real *real → real".
      MATH_COS
      Function "Math.cos", of type "real → real".
      MATH_COSH
      Function "Math.cosh", of type "real → real".
      MATH_E
      Constant "Math.e", of type "real", is the base e (2.718281828...) of the natural logarithm.
      MATH_EXP
      Function "Math.exp", of type "real → real".
      MATH_LN
      Function "Math.ln", of type "real → real".
      MATH_LOG10
      Function "Math.log10", of type "real → real".
      MATH_PI
      Constant "Math.pi", of type "real" is the constant pi (3.141592653...).
      MATH_POW
      Function "Math.pow", of type "real * real → real".
      MATH_SIN
      Function "Math.sin", of type "real → real".
      MATH_SINH
      Function "Math.sinh", of type "real → real".
      MATH_SQRT
      Function "Math.sqrt", of type "real → real".
      MATH_TAN
      Function "Math.tan", of type "real → real".
      MATH_TANH
      Function "Math.tanh", of type "real → real".
      NOT
      Function "not", of type "bool → bool".
      OP_CARET
      Infix operator "^", of type "string * string → string".
      OP_CONS
      Infix operator "::" (list cons), of type "α * α list → α list".
      OP_DIV
      Infix operator "div", of type "int * int → int".
      OP_DIVIDE
      Infix operator "/", of type "α * α → α" (where α must be numeric).
      OP_ELEM
      Infix operator "elem", of type "α * α list; → bool".
      OP_EQ
      Infix operator "=", of type "α * α → bool".
      OP_EXCEPT
      Infix operator "except", of type "α list * α list → α list".
      OP_GE
      Infix operator "≥", of type "α * α → bool" (where α must be comparable).
      OP_GT
      Infix operator ">", of type "α * α → bool" (where α must be comparable).
      OP_INTERSECT
      Infix operator "intersect", of type "α list * α list → α list".
      OP_LE
      Infix operator "≤", of type "α * α → bool" (where α must be comparable).
      OP_LT
      Infix operator "<", of type "α * α → bool" (where α must be comparable).
      OP_MINUS
      Infix operator "-", of type "α * α → α" (where α must be numeric).
      OP_MOD
      Infix operator "mod", of type "int * int → int".
      OP_NE
      Infix operator "<>", of type "α * α → bool".
      OP_NEGATE
      Prefix operator "~", of type "α → α" (where α must be numeric).
      OP_NOT_ELEM
      Infix operator "notelem", of type "α * α list; → bool".
      OP_PLUS
      Infix operator "+", of type "α * α → α" (where α must be numeric).
      OP_TIMES
      Infix operator "-", of type "α * α → α" (where α must be numeric).
      OP_UNION
      Infix operator "union", of type "α list * α list → α list".
      OPTION_APP
      Function "Option.app", of type "(α → unit) → α option → unit".
      OPTION_COMPOSE
      Function "Option.compose", of type "(α → β) * (γ → α option) → γ → β option".
      OPTION_COMPOSE_PARTIAL
      Function "Option.composePartial", of type "(α → β option) * (γ → α option) → γ → β option".
      OPTION_FILTER
      Function "Option.filter", of type "(α → bool) → α → α option".
      OPTION_FLATTEN
      Function "Option.flatten", of type "α option option → α option".
      OPTION_GET_OPT
      Function "Option.getOpt", of type "α option * α → α".
      OPTION_IS_SOME
      Function "Option.isSome", of type "α option → bool".
      OPTION_MAP
      Function "Option.map", of type "(α → β) → α option → β option".
      OPTION_MAP_PARTIAL
      Function "Option.mapPartial", of type "(α → β option) → α option → β option".
      OPTION_VAL_OF
      Function "Option.valOf", of type "α option → α".
      REAL_ABS
      Function "Real.abs", of type "real → real".
      REAL_CEIL
      Function "Real.ceil", of type "real → int".
      REAL_CHECK_FLOAT
      Function "Real.checkFloat", of type "real → real".
      REAL_COMPARE
      Function "Real.compare", of type "real * real → real".
      REAL_COPY_SIGN
      Function "Real.copySign", of type "real * real → real".
      REAL_FLOOR
      Function "Real.floor", of type "real → int".
      REAL_FROM_INT
      Function "Real.fromInt", of type "int → real".
      REAL_FROM_MAN_EXP
      Function "Real.fromManExp r", of type "{exp:int, man:real} → real" returns {man, exp}, where man and exp are the mantissa and exponent of r, respectively.
      REAL_FROM_STRING
      Function "Real.fromString s", of type "string → real option", scans a real value from a string.
      REAL_IS_FINITE
      Function "Real.isFinite", of type "real → bool".
      REAL_IS_NAN
      Function "Real.isNan", of type "real → bool".
      REAL_IS_NORMAL
      Function "Real.isNormal", of type "real → bool".
      REAL_MAX
      Function "Real.max", of type "real * real → real".
      REAL_MAX_FINITE
      Constant "Real.maxFinite", of type "real".
      REAL_MIN
      Function "Real.min", of type "real * real → real".
      REAL_MIN_NORMAL_POS
      Constant "Real.minNormalPos", of type "real".
      REAL_MIN_POS
      Constant "Real.minPos", of type "real".
      REAL_NEG_INF
      Constant "Real.negInf", of type "real".
      REAL_POS_INF
      Constant "Real.posInf", of type "real".
      REAL_PRECISION
      Constant "Real.precision", of type "int".
      REAL_RADIX
      Constant "Real.radix", of type "int".
      REAL_REAL_CEIL
      Function "Real.realCeil", of type "real → real".
      REAL_REAL_FLOOR
      Function "Real.realFloor", of type "real → real".
      REAL_REAL_MOD
      Function "Real.realMod", of type "real * real → real".
      REAL_REAL_ROUND
      Function "Real.realRound", of type "real → real".
      REAL_REAL_TRUNC
      Function "Real.realTrunc", of type "real → real".
      REAL_REM
      Function "Real.rem", of type "real * real → real".
      REAL_ROUND
      Function "Real.round", of type "real → int".
      REAL_SAME_SIGN
      Function "Real.sameSign", of type "real * real → bool".
      REAL_SIGN
      Function "Real.sign", of type "real → int".
      REAL_SIGN_BIT
      Function "Real.signBit", of type "real → bool".
      REAL_SPLIT
      Function "Real.split", of type "real → {frac:real, whole:real}".
      REAL_TO_MAN_EXP
      Function "Real.fromManExp r", of type "{exp:int, man:real} → real" returns {man, exp}, where man and exp are the mantissa and exponent of r, respectively.
      REAL_TO_STRING
      Function "Real.toString", of type "real → string".
      REAL_TRUNC
      Function "Real.trunc", of type "real → int".
      REAL_UNORDERED
      Function "Real.unordered", of type "real * real → bool".
      RELATIONAL_COUNT
      Function "Relational.count", aka "count", of type "int list → int".
      RELATIONAL_EXISTS
      Function "Relational.exists", aka "exists", of type "α list → bool".
      RELATIONAL_ITERATE
      Function "Relational.iterate", aka "iterate", of type "α list → (α list → α list → α list) → α list".
      RELATIONAL_MAX
      Function "Relational.max", aka "max", of type "α list → α" (where α must be comparable).
      RELATIONAL_MIN
      Function "Relational.min", aka "min", of type "α list → α" (where α must be comparable).
      RELATIONAL_NOT_EXISTS
      Function "Relational.notExists", aka "notExists", of type "α list → bool".
      RELATIONAL_ONLY
      Function "Relational.only", aka "only", of type "α list → α".
      RELATIONAL_SUM
      Function "Relational.sum", aka "sum", of type "α list → α" (where α must be numeric).
      STRING_CONCAT
      Function "String.concat", of type "string list → string".
      STRING_CONCAT_WITH
      Function "String.concatWith", of type "string → string list → string".
      STRING_EXPLODE
      Function "String.explode", of type "string → char list".
      STRING_EXTRACT
      Function "String.extract", of type "string * int * int option → string".
      STRING_IMPLODE
      Function "String.implode", of type "char list → string".
      STRING_IS_PREFIX
      Function "String.isPrefix", of type "string → string → bool".
      STRING_IS_SUBSTRING
      Function "String.isSubstring", of type "string → string → bool".
      STRING_IS_SUFFIX
      Function "String.isSuffix", of type "string → string → bool".
      STRING_MAP
      Function "String.map", of type "(char → char) → string → string".
      STRING_MAX_SIZE
      Constant "String.maxSize", of type "int".
      STRING_SIZE
      Function "String.size", of type "string → int".
      STRING_STR
      Function "String.str", of type "char → string".
      STRING_SUB
      Function "String.sub", of type "string * int → char".
      STRING_SUBSTRING
      Function "String.substring", of type "string * int * int → string".
      STRING_TRANSLATE
      Function "String.translate", of type "(char → string) → string → string".
      SYS_ENV
      Function "Sys.env", aka "env", of type "unit → string list".
      SYS_PLAN
      Function "Sys.plan", aka "plan", of type "unit → string".
      SYS_SET
      Function "Sys.set", aka "set", of type "string * α → unit".
      SYS_SHOW
      Function "Sys.show", aka "set", of type "string → string option".
      SYS_UNSET
      Function "Sys.unset", aka "unset", of type "string → unit".
      TRUE
      Literal "true", of type "bool".
      VECTOR_ALL
      Function "Vector.all" of type "(α → bool) → α vector → bool".
      VECTOR_APP
      Function "Vector.app" of type "(α → unit) → α vector → unit".
      VECTOR_APPI
      Function "Vector.appi" of type "(int * α → unit) → α vector → unit".
      VECTOR_COLLATE
      Function "Vector.collate" of type "(α * α → order) → α vector * α vector → order".
      VECTOR_CONCAT
      Function "Vector.concat" of type "α vector list → α vector".
      VECTOR_EXISTS
      Function "Vector.exists" of type "(α → bool) → α vector → bool".
      VECTOR_FIND
      Function "Vector.find" of type "(α → bool) → α vector → α option".
      VECTOR_FINDI
      Function "Vector.findi" of type "(int * α → bool) → α vector → (int * α) option".
      VECTOR_FOLDL
      Function "Vector.foldl" of type "(α * β → β) → β → α vector → β".
      VECTOR_FOLDLI
      Function "Vector.foldli" of type "(int * α * β → β) → β → α vector → β".
      VECTOR_FOLDR
      Function "Vector.foldr" of type "(α * β → β) → β → α vector → β".
      VECTOR_FOLDRI
      Function "Vector.foldri" of type "(int * α * β → β) → β → α vector → β".
      VECTOR_FROM_LIST
      Function "Vector.fromList" of type "α list → α vector".
      VECTOR_LENGTH
      Function "Vector.length" of type "α vector → int".
      VECTOR_MAP
      Function "Vector.map" of type "(α → β) → α vector → β vector".
      VECTOR_MAPI
      Function "Vector.mapi" of type "(int * α → β) → α vector → β vector".
      VECTOR_MAX_LEN
      Constant "Vector.maxLen" of type "int".
      VECTOR_SUB
      Function "Vector.sub" of type "α vector * int → α".
      VECTOR_TABULATE
      Function "Vector.tabulate" of type "int * (int → α) → α vector".
      VECTOR_UPDATE
      Function "Vector.update" of type "α vector * int * α → α vector".
      Z_ANDALSO
      Internal operator "andalso", of type "bool * bool → bool".
      Z_DIVIDE_INT
      Internal divide operator "/", of type "int * int → int".
      Z_DIVIDE_REAL
      Internal divide operator "/", of type "real * real → real".
      Z_LIST
      Internal list constructor, e.g.
      Z_MINUS_INT
      Internal minus operator "-", of type "int * int → int".
      Z_MINUS_REAL
      Internal minus operator "-", of type "real * real → real".
      Z_NEGATE_INT
      Internal unary negation operator "~", of type "int → int".
      Z_NEGATE_REAL
      Internal unary negation operator "~", of type "real → real".
      Z_ORELSE
      Internal operator "orelse", of type "bool * bool → bool".
      Z_PLUS_INT
      Internal plus operator "+", of type "int * int → int".
      Z_PLUS_REAL
      Internal plus operator "+", of type "real * real → real".
      Z_SUM_INT
      Internal relational sum operator "sum", of type "int * int → int".
      Z_SUM_REAL
      Internal relational sum operator "sum", of type "real * real → real".
      Z_TIMES_INT
      Internal times operator "*", of type "int * int → int".
      Z_TIMES_REAL
      Internal times operator "*", of type "real * real → real".
    • Enum Constant Detail

      • TRUE

        public static final BuiltIn TRUE
        Literal "true", of type "bool".
      • FALSE

        public static final BuiltIn FALSE
        Literal "false", of type "bool".
      • NOT

        public static final BuiltIn NOT
        Function "not", of type "bool → bool".
      • ABS

        public static final BuiltIn ABS
        Function "abs", of type "int → int".
      • OP_CARET

        public static final BuiltIn OP_CARET
        Infix operator "^", of type "string * string → string".
      • OP_EXCEPT

        public static final BuiltIn OP_EXCEPT
        Infix operator "except", of type "α list * α list → α list".
      • OP_INTERSECT

        public static final BuiltIn OP_INTERSECT
        Infix operator "intersect", of type "α list * α list → α list".
      • OP_UNION

        public static final BuiltIn OP_UNION
        Infix operator "union", of type "α list * α list → α list".
      • OP_CONS

        public static final BuiltIn OP_CONS
        Infix operator "::" (list cons), of type "α * α list → α list".
      • OP_DIV

        public static final BuiltIn OP_DIV
        Infix operator "div", of type "int * int → int".
      • OP_DIVIDE

        public static final BuiltIn OP_DIVIDE
        Infix operator "/", of type "α * α → α" (where α must be numeric).
      • OP_EQ

        public static final BuiltIn OP_EQ
        Infix operator "=", of type "α * α → bool".
      • OP_GE

        public static final BuiltIn OP_GE
        Infix operator "≥", of type "α * α → bool" (where α must be comparable).
      • OP_GT

        public static final BuiltIn OP_GT
        Infix operator ">", of type "α * α → bool" (where α must be comparable).
      • OP_LE

        public static final BuiltIn OP_LE
        Infix operator "≤", of type "α * α → bool" (where α must be comparable).
      • OP_LT

        public static final BuiltIn OP_LT
        Infix operator "<", of type "α * α → bool" (where α must be comparable).
      • OP_NE

        public static final BuiltIn OP_NE
        Infix operator "<>", of type "α * α → bool".
      • OP_ELEM

        public static final BuiltIn OP_ELEM
        Infix operator "elem", of type "α * α list; → bool".
      • OP_NOT_ELEM

        public static final BuiltIn OP_NOT_ELEM
        Infix operator "notelem", of type "α * α list; → bool".
      • OP_MINUS

        public static final BuiltIn OP_MINUS
        Infix operator "-", of type "α * α → α" (where α must be numeric).
      • OP_MOD

        public static final BuiltIn OP_MOD
        Infix operator "mod", of type "int * int → int".
      • OP_PLUS

        public static final BuiltIn OP_PLUS
        Infix operator "+", of type "α * α → α" (where α must be numeric).
      • OP_NEGATE

        public static final BuiltIn OP_NEGATE
        Prefix operator "~", of type "α → α" (where α must be numeric).
      • OP_TIMES

        public static final BuiltIn OP_TIMES
        Infix operator "-", of type "α * α → α" (where α must be numeric).
      • IGNORE

        public static final BuiltIn IGNORE
        Function "General.ignore", of type "α → unit".
      • GENERAL_OP_O

        public static final BuiltIn GENERAL_OP_O
        Operator "General.op o", of type "(β → γ) * (α → β) → α → γ"

        "f o g" is the function composition of "f" and "g". Thus, "(f o g) a" is equivalent to "f (g a)".

      • INTERACT_USE

        public static final BuiltIn INTERACT_USE
        Function "Interact.use" of type "string → unit"

        "use f" loads source text from the file named `f`.

      • STRING_MAX_SIZE

        public static final BuiltIn STRING_MAX_SIZE
        Constant "String.maxSize", of type "int".

        "The longest allowed size of a string".

      • STRING_SIZE

        public static final BuiltIn STRING_SIZE
        Function "String.size", of type "string → int".

        "size s" returns |s|, the number of characters in string s.

      • STRING_SUB

        public static final BuiltIn STRING_SUB
        Function "String.sub", of type "string * int → char".

        "sub (s, i)" returns the ith character of s, counting from zero. This raises Subscript if i < 0 or |s| ≤ i.

      • STRING_EXTRACT

        public static final BuiltIn STRING_EXTRACT
        Function "String.extract", of type "string * int * int option → string".

        "extract (s, i, NONE)" and "extract (s, i, SOME j)" return substrings of s. The first returns the substring of s from the ith character to the end of the string, i.e., the string s[i..|s|-1]. This raises Subscript if i < 0 or |s| < i.

        The second form returns the substring of size j starting at index i, i.e., the string s[i..i+j-1]. It raises Subscript if i < 0 or j < 0 or |s| < i + j. Note that, if defined, extract returns the empty string when i = |s|.

      • STRING_SUBSTRING

        public static final BuiltIn STRING_SUBSTRING
        Function "String.substring", of type "string * int * int → string".

        "substring (s, i, j)" returns the substring s[i..i+j-1], i.e., the substring of size j starting at index i. This is equivalent to extract(s, i, SOME j).

      • STRING_CONCAT

        public static final BuiltIn STRING_CONCAT
        Function "String.concat", of type "string list → string".

        "concat l" is the concatenation of all the strings in l. This raises Size if the sum of all the sizes is greater than maxSize.

      • STRING_CONCAT_WITH

        public static final BuiltIn STRING_CONCAT_WITH
        Function "String.concatWith", of type "string → string list → string".

        "concatWith s l" returns the concatenation of the strings in the list l using the string s as a separator. This raises Size if the size of the resulting string would be greater than maxSize.

      • STRING_STR

        public static final BuiltIn STRING_STR
        Function "String.str", of type "char → string".

        "str c" is the string of size one containing the character c.

      • STRING_IMPLODE

        public static final BuiltIn STRING_IMPLODE
        Function "String.implode", of type "char list → string".

        "implode l" generates the string containing the characters in the list l. This is equivalent to concat (List.map str l). This raises Size if the resulting string would have size greater than maxSize.

      • STRING_EXPLODE

        public static final BuiltIn STRING_EXPLODE
        Function "String.explode", of type "string → char list".

        "explode s" is the list of characters in the string s.

      • STRING_MAP

        public static final BuiltIn STRING_MAP
        Function "String.map", of type "(char → char) → string → string".

        "map f s" applies f to each element of s from left to right, returning the resulting string. It is equivalent to implode(List.map f (explode s)).

      • STRING_TRANSLATE

        public static final BuiltIn STRING_TRANSLATE
        Function "String.translate", of type "(char → string) → string → string".

        "translate f s" returns the string generated from s by mapping each character in s by f. It is equivalent to {code concat(List.map f (explode s))}.

      • STRING_IS_PREFIX

        public static final BuiltIn STRING_IS_PREFIX
        Function "String.isPrefix", of type "string → string → bool".

        "isPrefix s1 s2" returns true if the string s1 is a prefix of the string s2. Note that the empty string is a prefix of any string, and that a string is a prefix of itself.

      • STRING_IS_SUBSTRING

        public static final BuiltIn STRING_IS_SUBSTRING
        Function "String.isSubstring", of type "string → string → bool".

        "isSubstring s1 s2" returns true if the string s1 is a substring of the string s2. Note that the empty string is a substring of any string, and that a string is a substring of itself.

      • STRING_IS_SUFFIX

        public static final BuiltIn STRING_IS_SUFFIX
        Function "String.isSuffix", of type "string → string → bool".

        "isSuffix s1 s2" returns true if the string s1 is a suffix of the string s2. Note that the empty string is a suffix of any string, and that a string is a suffix of itself.

      • LIST_NIL

        public static final BuiltIn LIST_NIL
        Constant "List.nil", of type "α list".

        "nil" is the empty list.

      • LIST_NULL

        public static final BuiltIn LIST_NULL
        Function "List.null", of type "α list → bool".

        "null l" returns true if the list l is empty.

      • LIST_LENGTH

        public static final BuiltIn LIST_LENGTH
        Function "List.length", of type "α list → int".

        "length l" returns the number of elements in the list l.

      • LIST_AT

        public static final BuiltIn LIST_AT
        Function "List.at", of type "α list * α list → α list".

        "l1 @ l2" returns the list that is the concatenation of l1 and l2.

      • LIST_OP_AT

        public static final BuiltIn LIST_OP_AT
        Operator "List.op @", of type "α list * α list → α list".

        "l1 @ l2" returns the list that is the concatenation of l1 and l2.

      • LIST_HD

        public static final BuiltIn LIST_HD
        Function "List.hd", of type "α list → α".

        "hd l" returns the first element of l. It raises Empty if l is nil.

      • LIST_TL

        public static final BuiltIn LIST_TL
        Function "List.tl", of type "α list → α list".

        "tl l" returns all but the first element of l. It raises empty if l is nil.

      • LIST_LAST

        public static final BuiltIn LIST_LAST
        Function "List.last", of type "α list → α".

        "last l" returns the last element of l. It raises empty if l is nil.

      • LIST_GET_ITEM

        public static final BuiltIn LIST_GET_ITEM
        Function "List.getItem", of type "α list → (α * α list) option".

        "getItem l" returns NONE if the list is empty, and SOME(hd l,tl l) otherwise. This function is particularly useful for creating value readers from lists of characters. For example, Int.scan StringCvt.DEC getItem has the type (int, char list) StringCvt.reader and can be used to scan decimal integers from lists of characters.

      • LIST_NTH

        public static final BuiltIn LIST_NTH
        Function "List.nth", of type "α list * int → α".

        "nth (l, i)" returns the ith element of the list l, counting from 0. It raises Subscript if i < 0 or i >= length l. We have nth(l,0) = hd l, ignoring exceptions.

      • LIST_TAKE

        public static final BuiltIn LIST_TAKE
        Function "List.take", of type "α list * int → α list".

        "take (l, i)" returns the first i elements of the list l. It raises Subscript if i < 0 or i > length l. We have take(l, length l) = l.

      • LIST_DROP

        public static final BuiltIn LIST_DROP
        Function "List.drop", of type "α list * int → α list".

        "drop (l, i)" returns what is left after dropping the first i elements of the list l.

        It raises Subscript if i < 0 or i > length l.

        It holds that take(l, i) @ drop(l, i) = l when 0 ≤ i ≤ length l.

        We also have drop(l, length l) = [].

      • LIST_REV

        public static final BuiltIn LIST_REV
        Function "List.rev", of type "α list → α list".

        "rev l" returns a list consisting of l's elements in reverse order.

      • LIST_CONCAT

        public static final BuiltIn LIST_CONCAT
        Function "List.concat", of type "α list list → α list".

        "concat l" returns the list that is the concatenation of all the lists in l in order. concat[l1,l2,...ln] = l1 @ l2 @ ... @ ln

      • LIST_REV_APPEND

        public static final BuiltIn LIST_REV_APPEND
        Function "List.revAppend", of type "α list * α list → α list".

        "revAppend (l1, l2)" returns (rev l1) @ l2.

      • LIST_APP

        public static final BuiltIn LIST_APP
        Function "List.app", of type "(α → unit) → α list → unit".

        "app f l" applies f to the elements of l, from left to right.

      • LIST_MAP

        public static final BuiltIn LIST_MAP
        Function "List.map", of type "(α → β) → α list → β list".

        "map f l" applies f to each element of l from left to right, returning the list of results.

      • LIST_MAP_PARTIAL

        public static final BuiltIn LIST_MAP_PARTIAL
        Function "List.mapPartial", of type "(α → β option) → α list → β list".

        "mapPartial f l" applies f to each element of l from left to right, returning a list of results, with SOME stripped, where f was defined. f is not defined for an element of l if f applied to the element returns NONE. The above expression is equivalent to: ((map valOf) o (filter isSome) o (map f)) l

      • LIST_FIND

        public static final BuiltIn LIST_FIND
        Function "List.find", of type "(α → bool) → α list → α option".

        "find f l" applies f to each element x of the list l, from left to right, until f x evaluates to true. It returns SOME(x) if such an x exists; otherwise it returns NONE.

      • LIST_FILTER

        public static final BuiltIn LIST_FILTER
        Function "List.filter", of type "(α → bool) → α list → α list".

        "filter f l" applies f to each element x of l, from left to right, and returns the list of those x for which f x evaluated to true, in the same order as they occurred in the argument list.

      • LIST_PARTITION

        public static final BuiltIn LIST_PARTITION
        Function "List.partition", of type "(α → bool) → α list → α list * α list".

        "partition f l" applies f to each element x of l, from left to right, and returns a pair (pos, neg) where pos is the list of those x for which f x evaluated to true, and neg is the list of those for which f x evaluated to false. The elements of pos and neg retain the same relative order they possessed in l.

      • LIST_FOLDL

        public static final BuiltIn LIST_FOLDL
        Function "List.foldl", of type "(α * β → β) → β → α list → β".

        "foldl f init [x1, x2, ..., xn]" returns f(xn,...,f(x2, f(x1, init))...) or init if the list is empty.

      • LIST_FOLDR

        public static final BuiltIn LIST_FOLDR
        Function "List.foldr", of type "(α * β → β) → β → α list → β".

        "foldr f init [x1, x2, ..., xn]" returns f(x1, f(x2, ..., f(xn, init)...)) or init if the list is empty.

      • LIST_EXISTS

        public static final BuiltIn LIST_EXISTS
        Function "List.exists", of type "(α → bool) → α list → bool".

        "exists f l" applies f to each element x of the list l, from left to right, until f x evaluates to true; it returns true if such an x exists and false otherwise.

      • LIST_ALL

        public static final BuiltIn LIST_ALL
        Function "List.all", of type "(α → bool) → α list → bool".

        "all f l" applies f to each element x of the list l, from left to right, until f x evaluates to false; it returns false if such an x exists and true otherwise. It is equivalent to not(exists (not o f) l)).

      • LIST_TABULATE

        public static final BuiltIn LIST_TABULATE
        Function "List.tabulate", of type "int * (int → α) → α list".

        "tabulate (n, f)" returns a list of length n equal to [f(0), f(1), ..., f(n-1)], created from left to right. It raises Size if n < 0.

      • LIST_COLLATE

        public static final BuiltIn LIST_COLLATE
        Function "List.collate", of type "(α * α → order) → α list * α list → order".

        "collate f (l1, l2)" performs lexicographic comparison of the two lists using the given ordering f on the list elements.

      • MATH_ACOS

        public static final BuiltIn MATH_ACOS
        Function "Math.acos", of type "real → real".

        "acos x" returns the arc cosine of x. acos is the inverse of cos. Its result is guaranteed to be in the closed interval [0,pi]. If the magnitude of x exceeds 1.0, returns NaN.

      • MATH_ASIN

        public static final BuiltIn MATH_ASIN
        Function "Math.asin", of type "real → real".

        "asin x" returns the arc sine of x. asin is the inverse of sin. Its result is guaranteed to be in the closed interval [-pi / 2, pi / 2]. If the magnitude of x exceeds 1.0, returns NaN.

      • MATH_ATAN

        public static final BuiltIn MATH_ATAN
        Function "Math.atan", of type "real → real".

        "atan x" returns the arc tangent of x. atan is the inverse of tan. For finite arguments, the result is guaranteed to be in the open interval (-pi / 2, pi / 2). If x is +infinity, it returns pi / 2; if x is -infinity, it returns -pi / 2.

      • MATH_ATAN2

        public static final BuiltIn MATH_ATAN2
        Function "Math.atan2", of type "real *real → real".

        "atan2 (x, y)" returns the arc tangent of (y / x) in the closed interval [-pi, pi], corresponding to angles within +-180 degrees. The quadrant of the resulting angle is determined using the signs of both x and y, and is the same as the quadrant of the point (x, y). When x = 0, this corresponds to an angle of 90 degrees, and the result is (real (sign y)) * pi / 2.0. It holds that

         sign (cos (atan2 (y, x))) = sign (x)

        and

        sign (sin (atan2 (y, x))) = sign (y)

        except for inaccuracies incurred by the finite precision of real and the approximation algorithms used to compute the mathematical functions. Rules for exceptional cases are specified in the following table.

        
            y                 x         atan2(y, x)
            ================= ========= ==========
            +-0               0 < x     +-0
            +-0               +0        +-0
            +-0               x < 0     +-pi
            +-0               -0        +-pi
            y, 0 < y          +-0       pi/2
            y, y < 0          +-0       -pi/2
            +-y, finite y > 0 +infinity +-0
            +-y, finite y > 0 -infinity +-pi
            +-infinity        finite x  +-pi/2
            +-infinity        +infinity +-pi/4
            +-infinity        -infinity +-3pi/4
         
      • MATH_COS

        public static final BuiltIn MATH_COS
        Function "Math.cos", of type "real → real".

        "cos x" returns the cosine of x, measured in radians. If x is an infinity, returns NaN.

      • MATH_COSH

        public static final BuiltIn MATH_COSH
        Function "Math.cosh", of type "real → real".

        "cosh x" returns the hyperbolic cosine of x, that is, (e(x) + e(-x)) / 2. It has the properties cosh +-0 = 1, cosh +-infinity = +-infinity.

      • MATH_E

        public static final BuiltIn MATH_E
        Constant "Math.e", of type "real", is the base e (2.718281828...) of the natural logarithm.
      • MATH_EXP

        public static final BuiltIn MATH_EXP
        Function "Math.exp", of type "real → real".

        "exp x" returns e(x), i.e., e raised to the x(th) power. If x is +infinity, it returns +infinity; if x is -infinity, it returns 0.

      • MATH_LN

        public static final BuiltIn MATH_LN
        Function "Math.ln", of type "real → real".

        "ln x" returns the natural logarithm (base e) of x. If x < 0, returns NaN; if x = 0, returns -infinity; if x is infinity, returns infinity.

      • MATH_LOG10

        public static final BuiltIn MATH_LOG10
        Function "Math.log10", of type "real → real".

        "log10 x" returns the decimal logarithm (base 10) of x. If x < 0, returns NaN; if x = 0, returns -infinity; if x is infinity, returns infinity.

      • MATH_PI

        public static final BuiltIn MATH_PI
        Constant "Math.pi", of type "real" is the constant pi (3.141592653...).
      • MATH_POW

        public static final BuiltIn MATH_POW
        Function "Math.pow", of type "real * real → real".

        "pow x" returns x(y), i.e., x raised to the y(th) power. For finite x and y, this is well-defined when x > 0, or when x < 0 and y is integral. Rules for exceptional cases are specified below.

        
            x                 y                             pow(x,y)
            ================= ============================= ==========
            x, including NaN  0                             1
            |x| > 1           +infinity                     +infinity
            |x| < 1           +infinity                     +0
            |x| > 1           -infinity                     +0
            |x| < 1           -infinity                     +infinity
            +infinity         y > 0                         +infinity
            +infinity         y < 0                         +0
            -infinity         y > 0, odd integer            -infinity
            -infinity         y > 0, not odd integer        +infinity
            -infinity         y < 0, odd integer            -0
            -infinity         y < 0, not odd integer        +0
            x                 NaN                           NaN
            NaN               y <> 0                        NaN
            +-1               +-infinity                    NaN
            finite x < 0      finite non-integer y          NaN
            +-0               y < 0, odd integer            +-infinity
            +-0               finite y < 0, not odd integer +infinity
            +-0               y > 0, odd integer            +-0
            +-0               y > 0, not odd integer        +0
         
      • MATH_SIN

        public static final BuiltIn MATH_SIN
        Function "Math.sin", of type "real → real".

        "sin x" returns the sine of x, measured in radians. If x is an infinity, returns NaN.

      • MATH_SINH

        public static final BuiltIn MATH_SINH
        Function "Math.sinh", of type "real → real".

        "sinh x" returns the hyperbolic sine of x, that is, (e(x) - e(-x)) / 2. It has the property sinh +-0 = +-0, sinh +-infinity = +-infinity.

      • MATH_SQRT

        public static final BuiltIn MATH_SQRT
        Function "Math.sqrt", of type "real → real".

        "sqrt x" returns the square root of x. sqrt (~0.0) = ~0.0. If x < 0, it returns NaN.

      • MATH_TAN

        public static final BuiltIn MATH_TAN
        Function "Math.tan", of type "real → real".

        "tan x" returns the tangent of x, measured in radians. If x is an infinity, these returns NaN. Produces infinities at various finite values, roughly corresponding to the singularities of the tangent function.

      • MATH_TANH

        public static final BuiltIn MATH_TANH
        Function "Math.tanh", of type "real → real".

        "tanh x" returns the hyperbolic tangent of x, that is, (sinh x) / (cosh x). It has the properties tanh +-0 = +-0, tanh +-infinity = +-1.

      • OPTION_GET_OPT

        public static final BuiltIn OPTION_GET_OPT
        Function "Option.getOpt", of type "α option * α → α".

        getOpt(opt, a) returns v if opt is SOME(v); otherwise it returns a.

      • OPTION_IS_SOME

        public static final BuiltIn OPTION_IS_SOME
        Function "Option.isSome", of type "α option → bool".

        isSome opt returns true if opt is SOME(v); otherwise it returns false.

      • OPTION_VAL_OF

        public static final BuiltIn OPTION_VAL_OF
        Function "Option.valOf", of type "α option → α".

        valOf opt returns v if opt is SOME(v); otherwise it raises Option.

      • OPTION_FILTER

        public static final BuiltIn OPTION_FILTER
        Function "Option.filter", of type "(α → bool) → α → α option".

        filter f a returns SOME(a) if f(a) is true and NONE otherwise.

      • OPTION_FLATTEN

        public static final BuiltIn OPTION_FLATTEN
        Function "Option.flatten", of type "α option option → α option".

        flatten opt maps NONE to NONE and SOME(v) to v.

        Note: In the Standard ML basis library, this function is called "join". We cannot use that name, because join is a keyword in Morel.

      • OPTION_APP

        public static final BuiltIn OPTION_APP
        Function "Option.app", of type "(α → unit) → α option → unit".

        app f opt applies the function f to the value v if opt is SOME(v), and otherwise does nothing.

      • OPTION_MAP

        public static final BuiltIn OPTION_MAP
        Function "Option.map", of type "(α → β) → α option → β option".

        map f opt maps NONE to NONE and SOME(v) to SOME(f v).

      • OPTION_MAP_PARTIAL

        public static final BuiltIn OPTION_MAP_PARTIAL
        Function "Option.mapPartial", of type "(α → β option) → α option → β option".

        mapPartial f opt maps NONE to NONE and SOME(v) to f (v).

      • OPTION_COMPOSE

        public static final BuiltIn OPTION_COMPOSE
        Function "Option.compose", of type "(α → β) * (γ → α option) → γ → β option".

        compose (f, g) a returns NONE if g(a) is NONE; otherwise, if g(a) is SOME(v), it returns SOME(f v).

        Thus, the compose function composes f with the partial function g to produce another partial function. The expression compose (f, g) is equivalent to (map f) o g.

      • OPTION_COMPOSE_PARTIAL

        public static final BuiltIn OPTION_COMPOSE_PARTIAL
        Function "Option.composePartial", of type "(α → β option) * (γ → α option) → γ → β option".

        composePartial (f, g) a returns NONE if g(a) is NONE; otherwise, if g(a) is SOME(v), it returns f(v).

        Thus, the composePartial function composes the two partial functions f and g to produce another partial function. The expression composePartial (f, g) is equivalent to (mapPartial f) o g.

      • REAL_ABS

        public static final BuiltIn REAL_ABS
        Function "Real.abs", of type "real → real".

        Returns the absolute value of r.

      • REAL_CEIL

        public static final BuiltIn REAL_CEIL
        Function "Real.ceil", of type "real → int".

        Returns largest int not larger than r.

      • REAL_CHECK_FLOAT

        public static final BuiltIn REAL_CHECK_FLOAT
        Function "Real.checkFloat", of type "real → real".

        "checkFloat x" raises Overflow if x is an infinity, and raises Div if x is NaN. Otherwise, it returns its argument.

      • REAL_COMPARE

        public static final BuiltIn REAL_COMPARE
        Function "Real.compare", of type "real * real → real".

        Returns x with the sign of y, even if y is NaN.

      • REAL_COPY_SIGN

        public static final BuiltIn REAL_COPY_SIGN
        Function "Real.copySign", of type "real * real → real".

        Returns x with the sign of y, even if y is NaN.

      • REAL_FLOOR

        public static final BuiltIn REAL_FLOOR
        Function "Real.floor", of type "real → int".

        Returns smallest int not less than r.

      • REAL_FROM_INT

        public static final BuiltIn REAL_FROM_INT
        Function "Real.fromInt", of type "int → real". Converts the integer i to a real value. If the absolute value of i is larger than maxFinite, then the appropriate infinity is returned. If i cannot be exactly represented as a real value, then the current rounding mode is used to determine the resulting value. The top-level function real is an alias for Real.fromInt.
      • REAL_FROM_MAN_EXP

        public static final BuiltIn REAL_FROM_MAN_EXP
        Function "Real.fromManExp r", of type "{exp:int, man:real} → real" returns {man, exp}, where man and exp are the mantissa and exponent of r, respectively.
      • REAL_FROM_STRING

        public static final BuiltIn REAL_FROM_STRING
        Function "Real.fromString s", of type "string → real option", scans a real value from a string. Returns SOME(r) if a real value can be scanned from a prefix of s, ignoring any initial whitespace; otherwise, it returns NONE. This function is equivalent to StringCvt.scanString scan.
      • REAL_IS_FINITE

        public static final BuiltIn REAL_IS_FINITE
        Function "Real.isFinite", of type "real → bool".

        "isFinite x" returns true if x is neither NaN nor an infinity.

      • REAL_IS_NAN

        public static final BuiltIn REAL_IS_NAN
        Function "Real.isNan", of type "real → bool".

        "isNan x" returns true if x is NaN.

      • REAL_IS_NORMAL

        public static final BuiltIn REAL_IS_NORMAL
        Function "Real.isNormal", of type "real → bool".

        "isNormal x" returns true if x is normal, i.e., neither zero, subnormal, infinite nor NaN.

      • REAL_NEG_INF

        public static final BuiltIn REAL_NEG_INF
        Constant "Real.negInf", of type "real".

        The negative infinity value.

      • REAL_POS_INF

        public static final BuiltIn REAL_POS_INF
        Constant "Real.posInf", of type "real".

        The positive infinity value.

      • REAL_RADIX

        public static final BuiltIn REAL_RADIX
        Constant "Real.radix", of type "int".

        The base of the representation, e.g., 2 or 10 for IEEE floating point.

      • REAL_PRECISION

        public static final BuiltIn REAL_PRECISION
        Constant "Real.precision", of type "int".

        The number of digits, each between 0 and radix - 1, in the mantissa. Note that the precision includes the implicit (or hidden) bit used in the IEEE representation (e.g., the value of Real64.precision is 53).

      • REAL_MAX

        public static final BuiltIn REAL_MAX
        Function "Real.max", of type "real * real → real".

        Returns the returns the larger of the arguments. If exactly one argument is NaN, returns the other argument. If both arguments are NaN, returns NaN.

      • REAL_MAX_FINITE

        public static final BuiltIn REAL_MAX_FINITE
        Constant "Real.maxFinite", of type "real".

        The maximum finite number.

      • REAL_MIN

        public static final BuiltIn REAL_MIN
        Function "Real.min", of type "real * real → real".

        Returns the returns the larger of the arguments. If exactly one argument is NaN, returns the other argument. If both arguments are NaN, returns NaN.

      • REAL_MIN_POS

        public static final BuiltIn REAL_MIN_POS
        Constant "Real.minPos", of type "real".

        The minimum non-zero positive number.

      • REAL_MIN_NORMAL_POS

        public static final BuiltIn REAL_MIN_NORMAL_POS
        Constant "Real.minNormalPos", of type "real".

        The minimum non-zero normalized number.

      • REAL_REAL_MOD

        public static final BuiltIn REAL_REAL_MOD
        Function "Real.realMod", of type "real * real → real".

        Returns the fractional part of r. "realMod" is equivalent to "#frac o split".

      • REAL_REAL_CEIL

        public static final BuiltIn REAL_REAL_CEIL
        Function "Real.realCeil", of type "real → real".

        Returns the smallest integer-valued real not less than r.

      • REAL_REAL_FLOOR

        public static final BuiltIn REAL_REAL_FLOOR
        Function "Real.realFloor", of type "real → real".

        Returns the largest integer-valued real not larger than r.

      • REAL_REAL_ROUND

        public static final BuiltIn REAL_REAL_ROUND
        Function "Real.realRound", of type "real → real".

        Returns the integer-valued real nearest to r. In the case of a tie, it rounds to the nearest even integer.

      • REAL_REAL_TRUNC

        public static final BuiltIn REAL_REAL_TRUNC
        Function "Real.realTrunc", of type "real → real".

        Returns the r rounded towards zero.

      • REAL_REM

        public static final BuiltIn REAL_REM
        Function "Real.rem", of type "real * real → real".

        Returns the remainder x - n * y, where n = trunc (x / y). The result has the same sign as x and has absolute value less than the absolute value of y. If x is an infinity or y is 0, returns NaN. If y is an infinity, returns x.

      • REAL_ROUND

        public static final BuiltIn REAL_ROUND
        Function "Real.round", of type "real → int".

        Returns the integer nearest to r. In the case of a tie, it rounds to the nearest even integer.

      • REAL_SAME_SIGN

        public static final BuiltIn REAL_SAME_SIGN
        Function "Real.sameSign", of type "real * real → bool".

        Returns true if and only if signBit r1 equals signBit r2.

      • REAL_SIGN

        public static final BuiltIn REAL_SIGN
        Function "Real.sign", of type "real → int".

        Returns ~1 if r is negative, 0 if r is zero, or 1 if r is positive. An infinity returns its sign; a zero returns 0 regardless of its sign. It raises Domain on NaN.

      • REAL_SIGN_BIT

        public static final BuiltIn REAL_SIGN_BIT
        Function "Real.signBit", of type "real → bool".

        Returns true if and only if the sign of r (infinities, zeros, and NaN, included) is negative.

      • REAL_SPLIT

        public static final BuiltIn REAL_SPLIT
        Function "Real.split", of type "real → {frac:real, whole:real}".

        Returns {frac, whole}, where frac and whole are the fractional and integral parts of r, respectively. Specifically, whole is integral, |frac| < 1.0, whole and frac have the same sign as r, and r = whole + frac.

        This function is comparable to modf in the C library. If r is +-infinity, whole is +-infinity and frac is +-0. If r is NaN, both whole and frac are NaN.

      • REAL_TO_MAN_EXP

        public static final BuiltIn REAL_TO_MAN_EXP
        Function "Real.fromManExp r", of type "{exp:int, man:real} → real" returns {man, exp}, where man and exp are the mantissa and exponent of r, respectively.
      • REAL_TO_STRING

        public static final BuiltIn REAL_TO_STRING
        Function "Real.toString", of type "real → string".

        "toString r" converts reals into strings. The value returned by toString t is equivalent to:

        
         (fmt (StringCvt.GEN NONE) r)
         
      • REAL_TRUNC

        public static final BuiltIn REAL_TRUNC
        Function "Real.trunc", of type "real → int".

        Returns r rounded towards zero.

      • REAL_UNORDERED

        public static final BuiltIn REAL_UNORDERED
        Function "Real.unordered", of type "real * real → bool".

        "unordered (x, y) returns true if x and y are unordered, i.e., at least one of x and y is NaN.

      • RELATIONAL_COUNT

        public static final BuiltIn RELATIONAL_COUNT
        Function "Relational.count", aka "count", of type "int list → int".

        Often used with group:

             from e in emps
             group deptno = (#deptno e)
               compute sumId = sum of (#id e)
           
      • RELATIONAL_EXISTS

        public static final BuiltIn RELATIONAL_EXISTS
        Function "Relational.exists", aka "exists", of type "α list → bool".

        For example,

        
         from d in depts
         where exists (
           from e in emps
           where e.deptno = d.deptno
           andalso e.job = 'CLERK')
         
      • RELATIONAL_NOT_EXISTS

        public static final BuiltIn RELATIONAL_NOT_EXISTS
        Function "Relational.notExists", aka "notExists", of type "α list → bool".

        For example,

        
         from d in depts
         where notExists (
           from e in emps
           where e.deptno = d.deptno
           andalso e.job = 'CLERK')
         

        notExists list is equivalent to not (exists list), but the former may be more convenient, because it requires fewer parentheses.

      • RELATIONAL_ONLY

        public static final BuiltIn RELATIONAL_ONLY
        Function "Relational.only", aka "only", of type "α list → α".

        "only list" returns the only element of list. It raises Empty if list is nil, Size if list has more than one element.

        "only" allows you to write the equivalent of a scalar sub-query:

        
         from e in emps
         yield {e.ename, dname = only (from d in depts
                                       where d.deptno = e.deptno
                                       yield d.dname)}
         
      • RELATIONAL_ITERATE

        public static final BuiltIn RELATIONAL_ITERATE
        Function "Relational.iterate", aka "iterate", of type "α list → (α list → α list → α list) → α list".

        "iterate initialList listUpdate" computes a fixed point, starting with a list and iterating by passing it to a function.

      • RELATIONAL_SUM

        public static final BuiltIn RELATIONAL_SUM
        Function "Relational.sum", aka "sum", of type "α list → α" (where α must be numeric).

        Often used with group:

             from e in emps
             group deptno = (#deptno e)
               compute sumId = sum of (#id e)
           
      • RELATIONAL_MAX

        public static final BuiltIn RELATIONAL_MAX
        Function "Relational.max", aka "max", of type "α list → α" (where α must be comparable).
      • RELATIONAL_MIN

        public static final BuiltIn RELATIONAL_MIN
        Function "Relational.min", aka "min", of type "α list → α" (where α must be comparable).
      • SYS_ENV

        public static final BuiltIn SYS_ENV
        Function "Sys.env", aka "env", of type "unit → string list".
      • SYS_PLAN

        public static final BuiltIn SYS_PLAN
        Function "Sys.plan", aka "plan", of type "unit → string".
      • SYS_SET

        public static final BuiltIn SYS_SET
        Function "Sys.set", aka "set", of type "string * α → unit".
      • SYS_SHOW

        public static final BuiltIn SYS_SHOW
        Function "Sys.show", aka "set", of type "string → string option".
      • SYS_UNSET

        public static final BuiltIn SYS_UNSET
        Function "Sys.unset", aka "unset", of type "string → unit".
      • VECTOR_MAX_LEN

        public static final BuiltIn VECTOR_MAX_LEN
        Constant "Vector.maxLen" of type "int".

        The maximum length of vectors supported by this implementation. Attempts to create larger vectors will result in the Size exception being raised.

      • VECTOR_FROM_LIST

        public static final BuiltIn VECTOR_FROM_LIST
        Function "Vector.fromList" of type "α list → α vector".

        fromList l creates a new vector from l, whose length is length l and with the ith element of l used as the ith element of the vector. If the length of the list is greater than maxLen, then the Size exception is raised.

      • VECTOR_TABULATE

        public static final BuiltIn VECTOR_TABULATE
        Function "Vector.tabulate" of type "int * (int → α) → α vector".

        tabulate (n, f) creates a vector of n elements, where the elements are defined in order of increasing index by applying f to the element's index. This is equivalent to the expression:

        fromList (List.tabulate (n, f))

        If n < 0 or maxLen < n, then the Size exception is raised.

      • VECTOR_LENGTH

        public static final BuiltIn VECTOR_LENGTH
        Function "Vector.length" of type "α vector → int".

        length vec returns |vec|, the length of the vector vec.

      • VECTOR_SUB

        public static final BuiltIn VECTOR_SUB
        Function "Vector.sub" of type "α vector * int → α".

        sub (vec, i) returns the ith element of the vector vec. If i < 0 or |vec| <= i, then the Subscript exception is raised.

      • VECTOR_UPDATE

        public static final BuiltIn VECTOR_UPDATE
        Function "Vector.update" of type "α vector * int * α → α vector".

        update (vec, i, x) returns a new vector, identical to vec, except the ith element of vec is set to x. If i < 0 or |vec| <= i, then the Subscript exception is raised.

      • VECTOR_CONCAT

        public static final BuiltIn VECTOR_CONCAT
        Function "Vector.concat" of type "α vector list → α vector".

        concat l returns the vector that is the concatenation of the vectors in the list l. If the total length of these vectors exceeds maxLen, then the Size exception is raised.

      • VECTOR_APPI

        public static final BuiltIn VECTOR_APPI
        Function "Vector.appi" of type "(int * α → unit) → α vector → unit".

        appi f vec applies the function f to the elements of a vector in left to right order (i.e., in order of increasing indices). The appi function is more general than app, and supplies both the element and the element's index to the function f. Equivalent to:

        List.app f (foldri (fn (i,a,l) => (i,a)::l) [] vec)
      • VECTOR_APP

        public static final BuiltIn VECTOR_APP
        Function "Vector.app" of type "(α → unit) → α vector → unit".

        app f vec applies the function f to the elements of a vector in left to right order (i.e., in order of increasing indices). Equivalent to:

        List.app f (foldr (fn (a,l) => a::l) [] vec)
      • VECTOR_MAPI

        public static final BuiltIn VECTOR_MAPI
        Function "Vector.mapi" of type "(int * α → β) → α vector → β vector".

        mapi f vec produces a new vector by mapping the function f from left to right over the argument vector. The form mapi is more general, and supplies f with the vector index of an element along with the element. Equivalent to:

        fromList (List.map f (foldri (fn (i,a,l) => (i,a)::l) [] vec))
      • VECTOR_MAP

        public static final BuiltIn VECTOR_MAP
        Function "Vector.map" of type "(α → β) → α vector → β vector".

        map f vec produces a new vector by mapping the function f from left to right over the argument vector. Equivalent to:

        fromList (List.map f (foldr (fn (a,l) => a::l) [] vec))
      • VECTOR_FOLDLI

        public static final BuiltIn VECTOR_FOLDLI
        Function "Vector.foldli" of type "(int * α * β → β) → β → α vector → β".

        foldli f init vec folds the function f over all the elements of a vector, using the value init as the initial value. Applies the function f from left to right (increasing indices). The functions foldli and foldri are more general, and supply both the element and the element's index to the function f.

      • VECTOR_FOLDRI

        public static final BuiltIn VECTOR_FOLDRI
        Function "Vector.foldri" of type "(int * α * β → β) → β → α vector → β".

        foldri f init vec folds the function f over all the elements of a vector, using the value init as the initial value. Applies the function f from right to left (decreasing indices). The functions foldli and foldri are more general, and supply both the element and the element's index to the function f.

      • VECTOR_FOLDL

        public static final BuiltIn VECTOR_FOLDL
        Function "Vector.foldl" of type "(α * β → β) → β → α vector → β".

        foldl f init vec folds the function f over all the elements of a vector, using the value init as the initial value. Applies the function f from left to right (increasing indices). Equivalent to

        foldli (fn (_, a, x) => f(a, x)) init vec
      • VECTOR_FOLDR

        public static final BuiltIn VECTOR_FOLDR
        Function "Vector.foldr" of type "(α * β → β) → β → α vector → β".

        foldr f init vec folds the function f over all the elements of a vector, using the value init as the initial value. Applies the function f from right to left (decreasing indices). Equivalent to

        foldri (fn (_, a, x) => f(a, x)) init vec
      • VECTOR_FINDI

        public static final BuiltIn VECTOR_FINDI
        Function "Vector.findi" of type "(int * α → bool) → α vector → (int * α) option".

        findi f vec applies f to each element of the vector vec, from left to right (i.e., increasing indices), until a true value is returned. If this occurs, the function returns the element; otherwise, it return NONE. The function findi is more general than find, and also supplies f with the vector index of the element and, upon finding an entry satisfying the predicate, returns that index with the element.

      • VECTOR_FIND

        public static final BuiltIn VECTOR_FIND
        Function "Vector.find" of type "(α → bool) → α vector → α option".

        find f vec applies f to each element of the vector vec, from left to right (i.e., increasing indices), until a true value is returned. If this occurs, the function returns the element; otherwise, it returns NONE.

      • VECTOR_EXISTS

        public static final BuiltIn VECTOR_EXISTS
        Function "Vector.exists" of type "(α → bool) → α vector → bool".

        exists f vec applies f to each element x of the vector vec, from left to right (i.e., increasing indices), until f(x) evaluates to true; it returns true if such an x exists and false otherwise.

      • VECTOR_ALL

        public static final BuiltIn VECTOR_ALL
        Function "Vector.all" of type "(α → bool) → α vector → bool".

        all f vec applies f to each element x of the vector vec, from left to right (i.e., increasing indices), until f(x) evaluates to false; it returns false if such an x exists and true otherwise. It is equivalent to not (exists (not o f) vec)).

      • VECTOR_COLLATE

        public static final BuiltIn VECTOR_COLLATE
        Function "Vector.collate" of type "(α * α → order) → α vector * α vector → order".

        collate f (v1, v2) performs lexicographic comparison of the two vectors using the given ordering f on elements.

      • Z_ANDALSO

        public static final BuiltIn Z_ANDALSO
        Internal operator "andalso", of type "bool * bool → bool".
      • Z_ORELSE

        public static final BuiltIn Z_ORELSE
        Internal operator "orelse", of type "bool * bool → bool".
      • Z_NEGATE_INT

        public static final BuiltIn Z_NEGATE_INT
        Internal unary negation operator "~", of type "int → int".
      • Z_NEGATE_REAL

        public static final BuiltIn Z_NEGATE_REAL
        Internal unary negation operator "~", of type "real → real".
      • Z_DIVIDE_INT

        public static final BuiltIn Z_DIVIDE_INT
        Internal divide operator "/", of type "int * int → int".
      • Z_DIVIDE_REAL

        public static final BuiltIn Z_DIVIDE_REAL
        Internal divide operator "/", of type "real * real → real".
      • Z_MINUS_INT

        public static final BuiltIn Z_MINUS_INT
        Internal minus operator "-", of type "int * int → int".
      • Z_MINUS_REAL

        public static final BuiltIn Z_MINUS_REAL
        Internal minus operator "-", of type "real * real → real".
      • Z_PLUS_INT

        public static final BuiltIn Z_PLUS_INT
        Internal plus operator "+", of type "int * int → int".
      • Z_PLUS_REAL

        public static final BuiltIn Z_PLUS_REAL
        Internal plus operator "+", of type "real * real → real".
      • Z_TIMES_INT

        public static final BuiltIn Z_TIMES_INT
        Internal times operator "*", of type "int * int → int".
      • Z_TIMES_REAL

        public static final BuiltIn Z_TIMES_REAL
        Internal times operator "*", of type "real * real → real".
      • Z_SUM_INT

        public static final BuiltIn Z_SUM_INT
        Internal relational sum operator "sum", of type "int * int → int".
      • Z_SUM_REAL

        public static final BuiltIn Z_SUM_REAL
        Internal relational sum operator "sum", of type "real * real → real".
      • Z_LIST

        public static final BuiltIn Z_LIST
        Internal list constructor, e.g. "list (1 + 2, 3)" implements "[1 + 2, 3]". It cannot be assigned a type, because the tuple is variadic.
    • Field Detail

      • structure

        public final String structure
        Name of the structure (e.g. "List", "String"), or null.
      • mlName

        public final String mlName
        Unqualified name, e.g. "map" (for "List.map") or "true".
      • alias

        public final String alias
        An alias, or null. For example, "List.map" has an alias "map".
      • typeFunction

        public final Function<TypeSystem,​Type> typeFunction
        Derives a type, in a particular type system, for this constant or function.
      • BY_ML_NAME

        public static final com.google.common.collect.ImmutableMap<String,​BuiltIn> BY_ML_NAME
    • Method Detail

      • values

        public static BuiltIn[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (BuiltIn c : BuiltIn.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static BuiltIn valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • dataTypes

        public static void dataTypes​(TypeSystem typeSystem,
                                     List<Binding> bindings)
        Defines built-in datatype and eqtype instances, e.g. option, vector.
      • defineEqType

        private static void defineEqType​(TypeSystem ts,
                                         String name,
                                         int varCount)