This page documents the functions and constants available in stdlib.vase for Jarlang.

Numeric Utilities

FunctionSignatureDescription
maxmax(a, b)Returns the greater of two values.
minmin(a, b)Returns the lesser of two values.
clampclamp(x, lo, hi)Restricts x to the range [lo, hi].
communecommune(a, b)Adds two numbers.
banishbanish(a, b)Subtracts b from a.
rallyrally(a, b)Multiplies two numbers.
slashslash(a, b)Divides a by b.
ascendascend(a, b)Raises a to the power b.
circle_areacircle_area(r)Calculates the area of a circle with radius r.
add1add1(x)Increments x by 1.

Advanced Numerics

FunctionSignatureDescription
factfact(n)Computes the factorial of n.
fibfib(n)Computes the nth Fibonacci number.
mean2mean2(a, b)Returns the mean of a and b.
absabs(x)Returns the absolute value of x.
sumTosumTo(n)Returns the sum of all integers from 1 to n.
approx_equalapprox_equal(a, b, eps)Checks if a and b are approximately equal within eps.
gcdgcd(a, b)Computes the greatest common divisor of a and b.
lcmlcm(a, b)Computes the least common multiple of a and b.
hypothypot(a, b)Returns the hypotenuse for sides a and b.
pow_intpow_int(a, n)Raises a to the integer power n.
invert_signinvert_sign(n)Returns n with its sign inverted.
modmod(a, b)Returns a modulo b.
signsign(x)Returns -1, 0, or 1 depending on the sign of x.
sqrtsqrt(x)Returns the square root of x.
map_rangemap_range(x, inMin, inMax, outMin, outMax)Maps x from one range to another.
is_evenis_even(n)Returns 1 if n is even, else 0.
is_oddis_odd(n)Returns 1 if n is odd, else 0.
is_primeis_prime(n)Returns 1 if n is prime, else 0.
deg2raddeg2rad(d)Converts degrees to radians.
rad2degrad2deg(r)Converts radians to degrees.
abs_intabs_int(x)Returns the absolute value of x as an integer.
safe_lcmsafe_lcm(a, b)Computes the LCM of a and b safely (handles zero).

String Helpers

FunctionSignatureDescription
concatconcat(a, b)Concatenates two values as strings.
tale_repeattale_repeat(s, n)Repeats string s n times.
barren_talebarren_tale(s)Returns 1 if string s is empty, else 0.

Constants

NameValueDescription
KELVIN_OFFSET273.15Offset for Celsius to Kelvin conversion.
G_SI9.80665Standard gravity (m/s²).
G_CONST6.67430 × 10⁻¹¹Gravitational constant.
EARTH_MASS5.972 × 10²⁴Earth's mass (kg).

Physics & Utility Functions

FunctionSignatureDescription
potential_energypotential_energy(m, h)Calculates potential energy m * g * h.
celsius_to_kelvincelsius_to_kelvin(c)Converts Celsius to Kelvin.
kelvin_to_celsiuskelvin_to_celsius(k)Converts Kelvin to Celsius.
orbital_period_yearsorbital_period_years(a_AU)Approximates orbital period in years for semi-major axis in AU.
orbital_period_secondsorbital_period_seconds(a_meters)Calculates orbital period (seconds) for radius in meters around Earth.
approx_equal_tolapprox_equal_tol(a, b)Checks if a and b are approximately equal using a local tolerance.