Modules
March 27, 2016 ยท View on GitHub
Standard modules are built into the interpreter. Functions can be imported
from standard modules using the use operator.
ketos=> (use math (sqrt))
()
ketos=> (sqrt 4.0)
2
code
The code module offers facilities for inspecting compiled bytecode objects.
compilereturns a compiledlambdavalue from an expression.disassembleprints information about alambdavalue to stdout.documentationreturns the docstring for the named item.get-constreturns a numbered const value from alambdaobject.get-valuereturns a numbered enclosed value from alambdaobject.module-documentationreturns the docstring for the named module.
math
The math module contains mathematical constants and functions.
These functions are identical to their Rust counterparts and include:
acos, acosh, asin, asinh, atan, atanh, atan2, cos, cosh,
degrees, ln, log, log2, log10, radians, sin, sinh, sqrt,
tan, and tanh.
Constants included are: e (Euler's number) and pi.
random
The random module provides access to random number generation functions.
randomreturns a random float value in the range[0.0, 1.0).shufflereturns a given list in random order.