Math
exp
(let exp (fun (_x) (...)))
Calculate e^number
Parameter
value
: the Number
Author
Example
(math:exp 1) # 2.7182...
ln
(let ln (fun (_x) (...)))
Calculate the logarithm of a number
Parameter
value
: the Number
Author
Example
(math:ln 1) # 0
ceil
(let ceil (fun (_x) (...)))
Get the smallest possible integer greater than the number
Parameter
value
: the Number
Author
Example
(math:ceil 0.2) # 1
floor
(let floor (fun (_x) (...)))
Get the smallest possible integer equal to the given number
Parameter
value
: the Number
Author
Example
(math:floor 1.7) # 1
round
(let round (fun (_x) (...)))
Get the smallest possible integer equal to or greater than the given number
Parameter
value
: the Number
Author
Example
(math:round 0.2) # 0
(math:round 0.6) # 1
NaN?
(let NaN? (fun (_x) (...)))
Check if a Number is NaN
Parameter
value
: the Number
Author
Example
(math:NaN? 2) # false
(math:NaN? nan) # true
Inf?
(let Inf? (fun (_x) (...)))
Check if a Number if Inf
Parameter
value
: the Number
Author
Example
(math:Inf? 1) # false
(math:Inf? nan) # false
cos
(let cos (fun (_x) (...)))
Calculate the cosinus of a number
Parameter
value
: the Number (radians)
Author
Example
(math:cos 0) # 1
(math:cos math:pi) # -1
sin
(let sin (fun (_x) (...)))
Calculate the sinus of a number
Parameter
value
: the Number (radians)
Author
Example
(math:sin 0) # 0
(math:cos (/ math:pi 2)) # 1
tan
(let tan (fun (_x) (...)))
Calculate the tangent of a number
Parameter
value
: the Number (radians)
Author
Example
(math:tan 0) # 0
(math:cos (/ math:pi 4)) # 1
arccos
(let arccos (fun (_x) (...)))
Calculate the arc cosinus of a number
Parameter
value
: the Number
Author
Example
(math:arccos 1) # 0
arcsin
(let arcsin (fun (_x) (...)))
Calculate the arc sinus of a number
Parameter
value
: the Number
Author
Example
(math:arcsin 1) # 1.570796326794897 (/ math:pi 2)
arctan
(let arctan (fun (_x) (...)))
Calculate the arc tangent of a number
Parameter
value
: the Number
Author
Example
(math:arctan 0) # 0
cosh
(let cosh (fun (_x) (...)))
Calculate the hyperbolic cosinus of a number
Parameter
value
: the Number
Author
sinh
(let sinh (fun (_x) (...)))
Calculate the hyperbolic sinus of a number
Parameter
value
: the Number
Author
tanh
(let tanh (fun (_x) (...)))
Calculate the hyperbolic tangent of a number
Parameter
value
: the Number
Author
acosh
(let acosh (fun (_x) (...)))
Calculate the hyperbolic arc cosinus of a number
Parameter
value
: the Number
Author
asinh
(let asinh (fun (_x) (...)))
Calculate the hyperbolic arc sinus of a number
Parameter
value
: the Number
Author
atanh
(let atanh (fun (_x) (...)))
Calculate the hyperbolic arc tangent of a number
Parameter
value
: the Number
Author
pi
(let pi <value>)
Pi value (3.14159…)
Author
e
(let e <value>)
E value (2.7182…)
Author
tau
(let tau <value>)
Tau, the ratio of the circumference to the radius of a circle, which is equal to 2*pi (6.28318…)
Author
Inf
(let Inf <value>)
Float infinite value
Author
NaN
(let NaN <value>)
Float not-a-number value
Author
abs
(let abs (fun (_x) (...)))
Return the absolute value of a number
Parameter
_x
: the number to get the absolute value of
Author
even
(let even (fun (_n) (...)))
Return true if the number is even, false otherwise
Parameter
_n
: the number
Author
odd
(let odd (fun (_n) (...)))
Return true if the number is odd, false otherwise
Parameter
_n
: the number
Author
min
(let min (fun (_a _b) (...)))
Get the minimum between two numbers
Parameters
_a
: the first number_b
: the second number
Author
max
(let max (fun (_a _b) (...)))
Get the maximum between two numbers
Parameters
_a
: the first number_b
: the second number
Author
pow
(let pow (fun (_x _a) (...)))
Get a number to a given power
Note: Note that it’s defined as exp(a * ln(x)), thus won’t work for negative numbers
Parameters
_x
: the number to pow_a
: the exponent
Author
sqrt
(let sqrt (fun (_x) (...)))
Get the square root of a number
Note: Square roots can’t be taken for negative numbers for obvious reasons.
Parameter
_x
: the number
Author
fibo
(let fibo (fun (n) (...)))
Run the fibonacci function on a number
Parameter
n
: the number
Author
Example
(fibo 45 0 1)
prime?
(let prime? (fun (n) (...)))
Check if a given number is prime
Parameter
n
: the number
Author
divs
(let divs (fun (n) (...)))
Returns the list of a number’s divisors
Parameter
n
: the number
Author
Example
(divs 6) # Returns [1 2 3 6]
log
(let log (fun (x n) (...)))
Returns the logarithm base n of a number
Parameters
x
: the numbern
: the base
Author
Example
(log 81 3) # Returns 4
log2
(let log2 (fun (x) (...)))
Returns the logarithm base 2 of a number
Parameter
x
: the number
Author
Example
(log2 128) # Returns 7
log10
(let log10 (fun (x) (...)))
Returns the logarithm base 10 of a number
Parameter
x
: the number
Author
Example
(log10 1000) # Returns 3
floordiv
(let floordiv (fun (a b) (...)))
Returns the quotient of the euclidian division of a and b
Parameters
a
: the dividendb
: the divisor
Author
Example
(floordiv 14 6) # Returns 2
complex
(let complex (fun (real imag) (...)))
Create a complex number
Parameters
real
: the real part of the complex numberimag
: the imaginary value
Author
Example
(let c (complex 1 2))
(print c.real " " c.imag) # 1 2
complex-add
(let complex-add (fun (_c0 _c1) (...)))
Compute the addition of two complex number
Parameters
_c0
: the first complex number_c1
: the second complex number
Author
Example
(let c (complex-add (complex 1 2) (complex 3 4)))
(print c.real " " c.imag) # 4 6
complex-sub
(let complex-sub (fun (_c0 _c1) (...)))
Compute the subtraction of two complex number
Parameters
_c0
: the first complex number_c1
: the second complex number
Author
Example
(let c (complex-sub (complex 1 2) (complex 3 4)))
(print c.real " " c.imag) # -2 -2
complex-mul
(let complex-mul (fun (_c0 _c1) (...)))
Compute the multiplication of two complex number
Parameters
_c0
: the first complex number_c1
: the second complex number
Author
Example
(let c (complex-mul (complex 1 2) (complex 3 4)))
(print c.real " " c.imag) # -5 10
complex-conjugate
(let complex-conjugate (fun (_c) (...)))
Compute the conjugate of a complex number
Parameter
_c
: the complex number
Author
Example
(let c (complex-conjugate (complex 1 2)))
(print c.real " " c.imag) # 1 -2
complex-module
(let complex-module (fun (_c) (...)))
Compute the module of a complex number
Parameter
_c
: the complex number
Author
Example
(let c (complex-module (complex 1 2)))
(print c) # 2.2360679774997896964...
complex-div
(let complex-div (fun (_c0 _c1) (...)))
Compute the division of two complex number
Parameters
_c0
: the first complex number_c1
: the second complex number
Author
Example
(let c (complex-div (complex 1 2) (complex 3 4)))
(print c.real " " c.imag) # 0.44 0.08
clamp
(let clamp (fun (_x _min _max) (...)))
Limit a given value to a range
Parameters
_x
: value to limit_min
: minimum_max
: maximum
Author
Example
(print (clamp 5 0 2)) # 2
(print (clamp 6 0 10)) # 6
lerp
(let lerp (fun (_x _v0 _v1) (...)))
Linearly interpolate a value in [0; 1] between two bounds
Parameters
_x
: value to interpolate (must be between 0 and 1)_v0
: lower bound_v1
: upper bound
Author
Example
(print (lerp 0.22 15 132)) # 40.74