The functions a RALGOL script can call, grouped by library. A script
calls them as namespace::name(args); see the language reference for the surrounding
syntax. The device validates every script when you deploy it, checking
that each function you use is available on that device. The functions
listed here are the ones the standard libraries provide, but a specific
device may ship a different or extended set — treat this list as
representative, and let the device’s deploy-time check be the authority.
A device-specific function list is available from neuroConn.
Library conventions
A few conventions apply across the function libraries:
Integer ABI. All arguments and return values are
64-bit integers. There is no floating-point type in a script.
x1000 scaling. Functions whose natural result is
fractional return it scaled by 1000 (three decimal places). Angles are
in milli-radians or milli-degrees, frequencies in millihertz, and so on;
the description notes the scaling where it applies.
Variadic functions flatten their arguments. Where a
signature shows values..., you may pass several scalars
and/or array slices; they are flattened into one sequence. For example
std::mean(ral.buffer[1..8]) averages the eight
elements.
Element-wise vs. reducing. Some variadic functions
reduce to a single value (sum, mean); others
return one value per input (abs, sqrt,
sort).
Integer math. Mathematical functions operate on
integers and truncate, e.g. std::sqrt(10) is 3.
In the tables below, a signature like name(a, b) -> 1
means two arguments and one return value;
name(values...) -> 1 is variadic reducing to one;
name(values...) -> n returns as many values as it
received.
std — standard library
Comparison
Each returns 1 (true) or 0 (false).
Signature
Description
std::gt(a, b)
a greater than b
std::lt(a, b)
a less than b
std::ge(a, b)
a greater than or equal
std::le(a, b)
a less than or equal
std::eq(a, b)
a equal to b
std::ne(a, b)
a not equal to b
Logic
Signature
Description
std::and(a, b)
logical AND (1/0)
std::or(a, b)
logical OR
std::not(a)
logical NOT
std::xor(a, b)
bitwise/logical XOR
std::nand(a, b)
NOT AND
std::nor(a, b)
NOT OR
Arithmetic
Signature
Description
std::add(a, b)
a + b (also the + operator)
std::subtract(a, b)
a - b (also -)
std::multiply(a, b)
a x b (also *)
std::divide(a, b)
a / b; errors on division by zero (also /)
std::modulo(a, b)
remainder a mod b; returns 0 if b is 0
std::power(a, b)
a raised to the power b
std::abs(values...) -> n
absolute value, element-wise
std::sqrt(values...) -> n
integer square root, element-wise
std::sign(values...) -> n
-1, 0, or 1 per element
std::exp(values...) -> n
e^x, element-wise (integer)
std::log(values...) -> n
natural log, element-wise (integer)
std::log10(values...) -> n
base-10 log, element-wise (integer)
std::gcd(a, b)
greatest common divisor
std::lcm(a, b)
least common multiple
std::factorial(n)
n! (memoised)
std::clamp(x, lo, hi)
x limited to the range [lo, hi]
std::is_even(values...) -> n
1 if even, else 0, per element
std::is_odd(values...) -> n
1 if odd, else 0, per element
std::is_prime(n)
1 if n is prime, else 0
Statistics (reduce a
sequence to one value)
Signature
Description
std::sum(values...)
sum of all elements
std::prod(values...)
product of all elements
std::min(values...)
minimum
std::max(values...)
maximum
std::range(values...)
max - min
std::mean(values...)
arithmetic mean
std::median(values...)
median
std::variance(values...)
population variance
std::std_dev(values...)
population standard deviation
std::sum_of_squares(values...)
sum of each element squared
std::rms(values...)
root mean square
std::skewness(values...)
skewness
std::kurtosis(values...)
excess kurtosis (- 3)
std::harmonic_mean(values...)
harmonic mean
std::geometric_mean(values...)
geometric mean
std::iqr(values...)
interquartile range (Q3 - Q1)
Vector operations (return a
sequence)
Signature
Description
std::sort(values...) -> n
ascending sort
std::reverse(values...) -> n
reverse order
std::mode(values...) -> n
most frequent value(s)
std::zscore(values...) -> n
standardised score per element
std::assign(a, b)
assign (exposed form of the built-in assignment)
Data generation
Signature
Description
std::random(size, max)
sequence of size random integers in [0, max]
std::iota(start, end)
sequence start, start+1, …, end
mntg — montage helpers
Signature
Description
mntg::bipolarize(a, b)
bipolar derivation a - b
mntg::laplacian(c, n1, n2, n3, n4)
surface Laplacian: centre - mean of 4 neighbours
ringbuffer —
rolling-window analysis
Declared with let ringbuffer(N) -> @name; in the
prolog and used through the method-call form
@name::method(...). Analysis results are scaled x1000.
Method
Description
@buf::append(sample)
push one sample into the window
@buf::reset()
empty the window, keep the storage
@buf::clear()
release the storage
@buf::mova()
moving average over the window (x1000)
@buf::sd()
sample standard deviation, Bessel-corrected (x1000)
@buf::fft(bin)
magnitude of a single DFT bin (x1000)
@buf::fft_phase(bin)
phase of a single DFT bin, in milli-radians (x1000)
References
Language reference — the script
syntax, interface block, and control flow.