Reference
std/*
The standard library: what the language provides in every host, and why all of it is pure.
The standard library is what the language provides in every host. A target may not decline any of it, which is what standard means here, and all 16 of these are pure: they observe nothing, because a clock, a scene and a world all belong to a host, so a library function that read one would belong under that host prefix instead.
std/math 13
abs
puredeterministic
fn(x: float) -> float
The magnitude of a number.
min
puredeterministic
fn(a: float, b: float) -> float
The smaller of two numbers.
max
puredeterministic
fn(a: float, b: float) -> float
The larger of two numbers.
clamp
puredeterministic
fn(x: float, low: float, high: float) -> float
A number pinned between two bounds.
lerp
puredeterministic
fn(a: float, b: float, t: float) -> float
A value between two others. `t` is not clamped.
floor
puredeterministic
fn(x: float) -> float
The largest whole number no greater than this.
ceil
puredeterministic
fn(x: float) -> float
The smallest whole number no less than this.
round
puredeterministic
fn(x: float) -> float
The nearest whole number, halves rounding up.
sqrt
puredeterministic
fn(x: float) -> float
The square root. Negative input yields a NaN.
sin
puredeterministic
fn(radians: float) -> float
The sine of an angle in radians.
cos
puredeterministic
fn(radians: float) -> float
The cosine of an angle in radians.
atan2
puredeterministic
fn(y: float, x: float) -> float
The angle to a point, in radians.
exp
puredeterministic
fn(x: float) -> float
Euler's number raised to this power.
std/time 3
seconds
puredeterministic
fn(duration: float) -> float
A duration in seconds. An identity, and the place a reader learns seconds are the base unit.
milliseconds
puredeterministic
fn(duration: float) -> float
A duration in milliseconds, for formatting. `250ms` is already 0.25 by the time this sees it.
progress
puredeterministic
fn(elapsed: float, total: float) -> float
How far through a duration something is, from 0 to 1. A zero total yields 1 rather than a NaN.