Built-ins
A Built-in is always available, with no use, and is the only kind of function a Guard may call. A Script’s own name may shadow one. The rules are in chapter 7.
An argument of the wrong kind raises wrong kind before any work is done, so the entries below list only the other errors each raises (every stdlib function).
Values
Section titled “Values”The full rules: chapter 7.
min(x, …)
The least of its arguments under <, the first of equal ones; a lone list argument gives the least of its items.
Also raises: out of domain, can't compare.
max(x, …)
The greatest of its arguments under <, the first of equal ones; a lone list argument gives the greatest of its items.
Also raises: out of domain, can't compare.
codePoint
Section titled “codePoint”codePoint(c)
The code point of c, a text of exactly one code point, as a number.
Also raises: out of domain.
fromCodePoint
Section titled “fromCodePoint”fromCodePoint(n)
The text of the code point n, normalised to NFC.
Also raises: out of domain.
upper(s)
s under Unicode full default uppercase mapping, then NFC.
lower(s)
s under Unicode full default lowercase mapping, then NFC.
offset
Section titled “offset”offset(needle, s)
The Character position where the leftmost match of needle, a text or a Text Pattern, starts in s, or 0 if there is none.
isDisposed
Section titled “isDisposed”isDisposed(o)
Whether the Host Object o has been disposed.
objectKind
Section titled “objectKind”objectKind(o)
The name of the Object Kind of the Host Object o, as text.
rangeStart
Section titled “rangeStart”rangeStart(r)
The first end of the range r, as written.
rangeEnd
Section titled “rangeEnd”rangeEnd(r)
The second end of the range r, as written.
kindOf
Section titled “kindOf”kindOf(x)
The name of the kind of x, as text, such as "number" or "civil date".
conforms
Section titled “conforms”conforms(value, shape)
Whether value fits the Shape shape.
Also raises: invalid shape.
check(value, shape)
value unchanged, if it fits the Shape shape; raises the first mismatch otherwise.
Also raises: invalid shape, not encodable.
explain
Section titled “explain”explain(value, shape)
The list of every mismatch of value against the Shape shape, empty if it fits.
Also raises: invalid shape.
functionArity
Section titled “functionArity”functionArity(f)
The range of argument counts the Function Value f accepts, from its required parameters to all of them.
functionName
Section titled “functionName”functionName(f)
The name of the function the Function Value f was made from, as defined, or Nothing for a Lambda.
offerAvailable
Section titled “offerAvailable”offerAvailable(textName)
Whether the current recovery’s retained failure chain has an eligible offer with this Name; false outside recovery or for a malformed or unknown Name.
Numbers
Section titled “Numbers”The full rules: chapter 7.
abs(x)
x without its sign.
floor(x)
The greatest integer at or below x.
ceiling
Section titled “ceiling”ceiling(x)
The least integer at or above x.
truncate
Section titled “truncate”truncate(x)
x with its fraction dropped, toward zero.
round(x, places = 0, mode = "half up")
x rounded to places digits after the point, by mode.
Also raises: out of domain.
sqrt(x)
The square root of x.
Also raises: out of domain.
exp(x)
e to the power x.
Also raises: overflow.
ln(x)
The natural logarithm of x.
Also raises: out of domain.
log10(x)
The base-10 logarithm of x.
Also raises: out of domain.
power(x, y)
x to the power y.
Also raises: out of domain, overflow.
sin(x)
The sine of x radians.
cos(x)
The cosine of x radians.
tan(x)
The tangent of x radians.
asin(x)
The arcsine of x, in radians from -pi/2 to pi/2.
Also raises: out of domain.
acos(x)
The arccosine of x, in radians from 0 to pi.
Also raises: out of domain.
atan(x)
The arctangent of x, in radians between -pi/2 and pi/2.
atan2(y, x)
The angle of the point (x, y) from the positive x-axis, in radians above -pi and at most pi.
Also raises: out of domain.
degrees
Section titled “degrees”degrees(x)
x radians in degrees.
Also raises: overflow.
radians
Section titled “radians”radians(x)
x degrees in radians.
random
Section titled “random”random(n)
A whole number from 1 to n, the next from the Script Group’s generator.
Also raises: out of domain.
The full rules: chapter 7.
bitAnd
Section titled “bitAnd”bitAnd(a, b)
The bits set in both a and b.
Also raises: out of domain.
bitOr(a, b)
The bits set in a, b or both.
Also raises: out of domain.
bitXor
Section titled “bitXor”bitXor(a, b)
The bits set in exactly one of a and b.
Also raises: out of domain.
bitNot
Section titled “bitNot”bitNot(x, width)
x with its low width bits inverted.
Also raises: out of domain.
bitShiftLeft
Section titled “bitShiftLeft”bitShiftLeft(x, n, width = nothing)
x shifted left n bits, kept to its low width bits when width is given.
Also raises: out of domain, overflow.
bitShiftRight
Section titled “bitShiftRight”bitShiftRight(x, n)
x shifted right n bits, filling with zeros.
Also raises: out of domain.
bitRotateLeft
Section titled “bitRotateLeft”bitRotateLeft(x, n, width)
The low width bits of x rotated left n places.
Also raises: out of domain.
bitRotateRight
Section titled “bitRotateRight”bitRotateRight(x, n, width)
The low width bits of x rotated right n places.
Also raises: out of domain.
bitCount
Section titled “bitCount”bitCount(x)
How many bits of x are set.
Also raises: out of domain.
bitTest
Section titled “bitTest”bitTest(x, i)
Whether bit i of x is set, bit 0 being the lowest.
Also raises: out of domain.
Floats
Section titled “Floats”The full rules: chapter 7.
fromFloat64
Section titled “fromFloat64”fromFloat64(b, order = "big")
The number an IEEE 754 binary64 float in the 8 Bytes b holds, as its shortest round-trip decimal.
Also raises: out of domain, can't convert.
fromFloat32
Section titled “fromFloat32”fromFloat32(b, order = "big")
The number an IEEE 754 binary32 float in the 4 Bytes b holds, as its shortest round-trip decimal.
Also raises: out of domain, can't convert.
toFloat64
Section titled “toFloat64”toFloat64(n, order = "big")
The 8 Bytes of the binary64 float nearest n, ties to even.
Also raises: out of domain.
toFloat32
Section titled “toFloat32”toFloat32(n, order = "big")
The 4 Bytes of the binary32 float nearest n, ties to even.
Also raises: out of domain.
The full rules: chapter 7.
year(d)
The year of the Civil Date d, from 1 to 9999.
month(d)
The month of d, from 1 to 12.
day(d)
The day of the month of d, from 1 to 31.
hour(d)
The hour of the date-time d, from 0 to 23.
Also raises: out of domain.
minute
Section titled “minute”minute(d)
The minute of the date-time d, from 0 to 59.
Also raises: out of domain.
second
Section titled “second”second(d)
The whole seconds of the date-time d, from 0 to 59.
Also raises: out of domain.
microsecond
Section titled “microsecond”microsecond(d)
The fraction of a second of the date-time d, in whole microseconds from 0 to 999999.
Also raises: out of domain.
weekday
Section titled “weekday”weekday(d)
The ISO 8601 day of the week of d, 1 for Monday to 7 for Sunday.
dayOfYear
Section titled “dayOfYear”dayOfYear(d)
The day of the year of d, from 1 to 366.
isoWeek
Section titled “isoWeek”isoWeek(d)
The ISO 8601 week number of d, from 1 to 53.
isoWeekYear
Section titled “isoWeekYear”isoWeekYear(d)
The ISO 8601 week-numbering year of d.
hasTime
Section titled “hasTime”hasTime(d)
Whether the Civil Date d has a time of day.
toCivil
Section titled “toCivil”toCivil(i, offset)
The date-time on the wall clock at the Instant i, at offset from UTC or under the Zone Rules offset.
Also raises: out of domain, out of range.
toInstant
Section titled “toInstant”toInstant(c, offset, disambiguation = nothing)
The Instant at which the wall clock, at offset from UTC or under the Zone Rules offset, reads the date-time c.
Also raises: out of domain, out of range, ambiguous time.
Constants
Section titled “Constants”The full rules: chapter 7.
pi = 3.141592653589793238462643383279503
pi, rounded half-even to 34 digits.
newline
Section titled “newline”newline = U+000A
A line feed, as text.
tab = U+0009
A tab, as text.
quote = U+0022
A double quote, as text.
Properties
Section titled “Properties”A Built-in property is read with the <name> of x, or x's <name>. What each gives, and of which kinds, is in chapter 4.
the length of xthe keys of xthe values of xthe items of xthe lines of xthe words of xthe characters of xthe bytes of xthe code points of xthe elements of x