Builtin functions#
The registry#
The names an author calls as a function without declaring one. A row named math.<name>, distance.<name> or calendar.<name> is a member of that module, called through its import by its qualified name or by the bare <name> a selective import binds. Every other row is global, and its name is a reserved word.
Column |
Holds |
|---|---|
Arities |
the argument counts accepted. A call with any other count is a compile error |
Tier |
the call’s purity tier, |
Signature |
each form’s parameters and result, |
Summary |
what the call answers |
Defined by |
the defining clause, which is right where it and the row differ |
A Float parameter takes an Int, converted. cursor is a series cursor, and T the type of the slot it reads. <unit> is a value with a unit, and the result <unit> is a value of the same unit; a builtin over a value with a unit is at Builtins over a dimensioned value.
A parameter is a value: a T? argument is refused, and a null that reaches one at run time raises a TypeError. has and math.fma differ: has tests a Json path for resolution, and math.fma takes its operands as x * y + z does.
Name |
Arities |
Tier |
Signature |
Summary |
Defined by |
|---|---|---|---|---|---|
|
1 |
pure |
(x: Int) → Int; (x: Float) → Float |
Absolute value, of the argument’s type. |
[LEXP.3.2] |
|
1 |
pure |
(x: Float) → Float |
Inverse cosine, in radians. |
|
|
1 |
pure |
(x: Float) → Float |
Inverse sine, in radians. |
|
|
1 |
pure |
(x: Float) → Float |
Inverse tangent, in radians. |
|
|
2 |
pure |
(y: Float, x: Float) → Float |
Angle of the point (x, y) from the positive x axis, in radians, in [−π, π]. |
|
|
1 |
sync-impure |
(key: String) → String? |
The cache’s value for the key, as JSON text; null on a miss. |
|
|
1 |
pure |
(x: Int) → Int; (x: Float) → Int; (x: |
Smallest integer not less than x; a Float with no Int answer traps. |
[LEXP.3.2] |
|
4, 6 |
pure |
(x1, y1, x2, y2: Float) → Float; (x1, y1, z1, x2, y2, z2: Float) → Float |
L∞ (chessboard) distance between two points, 2D or 3D. |
|
|
1 |
pure |
(x: Float) → Float |
Cosine of x radians. |
|
|
1 |
pure |
(x: Float) → Float |
Hyperbolic cosine. |
|
|
4, 6 |
pure |
(ax, ay, bx, by: Float) → Float; (ax, ay, az, bx, by, bz: Float) → Float |
Cosine distance, 1 − cos θ, between two vectors, in [0, 2]. |
|
|
3 |
pure |
(year: Int, month: Int, day: Int) → Date |
The Date of that calendar day. |
|
|
1 |
pure |
(x: Float) → Float |
Radians to degrees. |
|
|
4, 6 |
pure |
(x1, y1, x2, y2: Float) → Float; (x1, y1, z1, x2, y2, z2: Float) → Float |
L₂ distance between two points, 2D or 3D. |
|
|
1 |
pure |
(x: Float) → Float |
e to the power x. |
|
|
1 |
pure |
(x: Int) → Int; (x: Float) → Int; (x: |
Largest integer not greater than x; a Float with no Int answer traps. |
[LEXP.3.2] |
|
3 |
pure |
(x: Float, y: Float, z: Float) → Float |
x × y + z, rounded once. |
|
|
4 |
pure |
(lat1, lon1, lat2, lon2: Float) → meter |
Distance along the Earth’s surface between two points given in degrees. |
|
|
1 |
pure |
(path: Json path) → Bool |
Whether the Json path resolves. |
[LEXP.6.1] |
|
2, 3 |
pure |
(x, y: Float) → Float; (x, y, z: Float) → Float |
Length of a vector from the origin, 2D or 3D. |
[LEXP.5.5] |
|
1 |
pure |
(j: Json) → Int; (s: String) → Int; (b: Bytes) → Int |
A Json array’s length, a String’s code points, or a Bytes value’s bytes. |
|
|
1 |
pure |
(x: Float) → Float |
Natural logarithm. |
|
|
1 |
pure |
(x: Float) → Float |
Base-10 logarithm. |
|
|
1 |
pure |
(x: Float) → Float |
Base-2 logarithm. |
|
|
4, 6 |
pure |
(x1, y1, x2, y2: Float) → Float; (x1, y1, z1, x2, y2, z2: Float) → Float |
L₁ (taxicab) distance between two points, 2D or 3D. |
|
|
2 |
pure |
(a, b: Int | Float) → Int | Float; (a, b: |
The larger of a and b, of the winning operand’s type, a tie giving a; with a cursor alone, the series’ maximum. |
|
|
2 |
pure |
(a, b: Int | Float) → Int | Float; (a, b: |
The smaller of a and b, of the winning operand’s type, a tie giving a; with a cursor alone, the series’ minimum. |
|
|
0 |
sync-impure |
() → Duration |
The monotonic clock’s reading. |
|
|
0 |
sync-impure |
() → Time |
The wall-clock instant. |
|
|
2 |
pure |
(x: Int, y: Int) → Int; (x: Float, y: Float) → Float |
x to the power y; an Int only for an Int base and a statically non-negative Int exponent. |
[LEXP.3.2] |
|
1 |
pure |
(x: Float) → Float |
Degrees to radians. |
|
|
1 |
pure |
(x: Int) → Int; (x: Float) → Int; (x: |
Nearest integer, ties to even; a Float with no Int answer traps. |
[LEXP.3.2] |
|
1 |
pure |
(x: Int) → Int; (x: Float) → Int; (x: |
1 when x > 0, −1 when x < 0, else 0. |
[LEXP.3.2] |
|
1 |
pure |
(x: Float) → Float |
Sine of x radians. |
|
|
1 |
pure |
(x: Float) → Float |
Hyperbolic sine. |
|
|
1 |
pure |
(x: Float) → Float |
Square root, correctly rounded; NaN for a negative x. |
[LEXP.3.2] |
|
1 |
pure |
(x: Float) → Float |
Tangent of x radians. |
|
|
1 |
pure |
(x: Float) → Float |
Hyperbolic tangent. |
|
|
3, 6, 7 |
pure |
(year, month, day: Int) → Time; (year, month, day, hour, minute, second: Int) → Time; (year, month, day, hour, minute, second, nanosecond: Int) → Time |
The UTC instant of that calendar day and wall-clock time. |
|
|
1 |
pure |
(x: Int) → Int; (x: Float) → Int; (x: |
x truncated toward zero; a Float with no Int answer traps. |
[LEXP.3.2] |