alive
language reference
This section documents all builtins and modules that are currently available in the alive programming language.
If you are new to alive, the getting started guide is the recommended place to start. If you are looking for information on adding your own module or contributing to alive, check out the developer documentation.
module index
These modules can be imported using require
, import
and import*
.
builtins
These definitions are automatically loaded into the global Scope of every alive session.
- A `bang` value-constant.
- Declare symbols in current scope.
(def sym1 val-expr1 [sym2 val-expr2…])
Define the symbols
sym1
,sym2
, … to resolve to the values ofval-expr1
,val-expr2
, …. - Define a function.
(defn name-sym (p1 [p2…]) body-expr)
Declare a function and define it as
name-sym
in the current scope. The symbolsp1
,p2
, … will resolve to the arguments passed when the function is invoked. - Evaluate multiple expressions in a new scope.
(do expr1 [expr2…])
Evaluate
expr1
,expr2
, … and return the value of the last expression. - Print documentation in console.
(doc sym)
Print the documentation for
sym
to the console - Evaluate definitions in a new scope and return it.
(export expr1 [expr2…])
Evaluate
expr1
,expr2
, … in a new Scope and return scope. - Export specific symbol definitions as a module/scope.
(export* sym1 [sym2…])
(export*)
Creates a scope containing the symbols
sym1
,sym2
, … and returns it.Copies the containing scope if no symbols are given.
- The boolean constant `false`.
- Declare a function.
(fn (p1 [p2…]) body-expr)
The symbols
p1
,p2
, … will resolve to the arguments passed when the function is invoked. - Make an evaltime const choice.
(if bool then-expr [else-expr])
bool
has to be an evaltime constant. If it is truthy, this expression is equivalent tothen-expr
, otherwise it is equivalent toelse-xpr
if given, or nil otherwise. - Require and define modules.
(import sym1 [sym2…])
Requires modules
sym1
,sym2
, … and define them assym1
,sym2
, … in the current scope. - Require and use modules.
(import* sym1 [sym2…])
Requires modules
sym1
,sym2
, … and merges them into the current scope. - Print string values.
(print str)
- Load a module.
(require name)
Load a module and return its scope.
- Trace an expression's values at runtime.
(trace expr)
- Trace an expression's value at evaltime.
(trace! expr)
- The boolean constant `true`.
- Merge scopes into current scope.
(use scope1 [scope2…])
Copy all symbol definitions from
scope1
,scope2
, … to the current scope. All arguments have to be evaltime constant.