Numbers and Arithmetic

Arithmetic Operators

FunctionDescription
(∸ n)Unary minus; negate

The binary arithmetic operators +, -, *, and / are polymorphic: when either operand is an n-dimensional array, the operation is performed element-wise. One operand may be a scalar number. For purely numeric operands, the operators behave as before (/ performs floor division for numbers, but element-wise float division for arrays).

Numeric Functions

FunctionDescription
incIncrement number x by 1
decDecrement number x by 1
negateNegate number n
zero?Return true if and only if number n is 0
pos?Return true if and only if number n is strictly positive
neg?Return true if and only if number n is strictly negative
numParse number from string
floorRound number downwards to nearest integer
ceilingRound number upwards to nearest integer
pow(b, e)Raise b to the power e
div(a, b)Floor division; same as a / b
mod(a, b)Floor modulus; same as a % b
quot(a, b)Truncation division; rounds toward zero
rem(a, b)Truncation remainder; result has same sign as dividend
sumSum a list of numbers
max(l, r)Return max of numbers l and r
max-of(l)max-of(l) - return max element in list of numbers l - error if empty
min(l, r)Return min of numbers l and r
min-of(l)min-of(l) - return min element in list of numbers l - error if empty