Function Reference
Functions currently exposed by the Run-Calc evaluator.
How to use this page
- Use the left sidebar to jump to a function group.
- Examples are evaluator-ready snippets you can paste into Run-Calc lines.
Number Functions
Numeric helpers currently available in the Run-Calc evaluator.
max(n1, n2)Returns the larger of two numbers.
Example:
max(5, 7)min(n1, n2)Returns the smaller of two numbers.
Example:
min(5, 7)abs(n)Returns absolute value.
Example:
abs(-5)ceil(n)Rounds up to nearest integer.
Example:
ceil(1.5)floor(n)Rounds down to nearest integer.
Example:
floor(1.5)round(n)Rounds to nearest integer.
Example:
round(1.5)pow(base, exponent)Raises base to exponent.
Example:
pow(2, 8)sqrt(n)Square root.
Example:
sqrt(9)cbrt(n)Cube root.
Example:
cbrt(27)exp(n)Exponential function e^n.
Example:
exp(1)log(n)Natural logarithm.
Example:
log(E)log10(n)Base-10 logarithm.
Example:
log10(100)log2(n)Base-2 logarithm.
Example:
log2(8)sin(n)Sine (radians).
Example:
sin(PI / 2)cos(n)Cosine (radians).
Example:
cos(PI)tan(n)Tangent (radians).
Example:
tan(PI / 4)asin(n)Arc-sine (radians).
Example:
asin(1)acos(n)Arc-cosine (radians).
Example:
acos(0)atan(n)Arc-tangent (radians).
Example:
atan(1)atan2(y, x)Arc-tangent from y/x preserving quadrant.
Example:
atan2(1, 1)sinh(n)Hyperbolic sine.
Example:
sinh(1)cosh(n)Hyperbolic cosine.
Example:
cosh(1)tanh(n)Hyperbolic tangent.
Example:
tanh(1)asinh(n)Inverse hyperbolic sine.
Example:
asinh(1)acosh(n)Inverse hyperbolic cosine.
Example:
acosh(2)atanh(n)Inverse hyperbolic tangent.
Example:
atanh(0.5)hypot(x, y)Hypotenuse length sqrt(x*x + y*y).
Example:
hypot(3, 4)trunc(n)Truncates fractional part.
Example:
trunc(1.9)sign(n)Returns -1, 0, or 1 based on sign.
Example:
sign(-42)
Array and Predicate Functions
Filtering, projection, aggregation, searching, sorting, and reduction over lists.
all(array, predicate)True when every element matches.
Example:
all(tweets, {.Size < 280})any(array, predicate)True when any element matches.
Example:
any(tweets, {.Size > 280})one(array, predicate)True when exactly one element matches.
Example:
one(users, {.Winner})none(array, predicate)True when no elements match.
Example:
none(tweets, {.Size > 280})map(array, predicate)Transforms each element and returns a new array.
Example:
map(tweets, {.Size})filter(array, predicate)Returns elements that satisfy predicate.
Example:
filter(users, .Name startsWith "J")find(array, predicate)Returns first matching element.
Example:
find([1, 2, 3, 4], # > 2)findIndex(array, predicate)Returns first matching index.
Example:
findIndex([1, 2, 3, 4], # > 2)findLast(array, predicate)Returns last matching element.
Example:
findLast([1, 2, 3, 4], # > 2)findLastIndex(array, predicate)Returns last matching index.
Example:
findLastIndex([1, 2, 3, 4], # > 2)count(array[, predicate])Counts matched elements; alias to len(array) when used as function call.
Example:
count(users, .Age > 18)concat(array1, array2[, ...])Concatenates two or more arrays.
Example:
concat([1, 2], [3, 4])flatten(array)Flattens nested arrays into one level.
Example:
flatten([1, [2, 3]])uniq(array)Removes duplicate values.
Example:
uniq([1, 2, 3, 2])join(array[, delimiter])Joins array of strings into one string.
Example:
join(["a", "b"], ",")reduce(array, predicate[, initialValue])Reduces array to one value using #acc, #, and #index.
Example:
reduce(1..9, #acc + #, 0)sum(array[, predicate])Sums numeric elements or projected values.
Example:
sum(accounts, .Balance)mean(array)Average of numeric elements.
Example:
mean([1, 2, 3])median(array)Median of numeric elements.
Example:
median([1, 2, 3])first(array)First element or nil for empty array.
Example:
first([1, 2, 3])last(array)Last element or nil for empty array.
Example:
last([1, 2, 3])take(array, n)Returns first n elements.
Example:
take([1, 2, 3, 4], 2)reverse(array)Returns reversed copy of array.
Example:
reverse([3, 1, 4])sort(array[, order])Sorts ascending by default, or desc.
Example:
sort([3, 1, 4], "desc")sortBy(array[, predicate, order])Sorts by derived value from predicate.
Example:
sortBy(users, .Age, "desc")avg(array)App alias for mean(...).
Example:
avg([1, 2, 3])In function-call form, avg(...) is rewritten to mean(...).
array | each(mapper)App pipeline alias for map(...) stage.
Example:
[0, PI/2] | each(sin)Supported in pipeline stages as an alias of map.
App-Specific Function Extensions
Functions and helpers that are explicitly provided by Run-Calc.
normal()Returns random value from standard normal distribution.
Example:
normal()uniform()Returns random value in [0, 1).
Example:
uniform()mod64(a, b)Internal helper used to support % with mixed numeric forms.
Example:
mod64(11, 5)You can normally use the % operator directly.