This page is a work-in-progress. For a comprehensive list of built-in procedures, consult the output of all-builtins and the src/stdlib directory in source code.

Control


quote vv

Read the next datum in the program and put it on top of the stack.


symbol uplevel → …

Evaluate symbol in the context of the calling program.

Attempting to call this in the root context (the toplevel program) is an error.


symbol eval-builtin → …

Evaluate symbol as the name of a built-in function, without first looking it up as a definition.

If no such function exists, raise an error.


symbol call → …

Evaluate symbol as if it appeared at this point in the program.


bool symbol call-when → …

If bool is true, evaluate symbol as if it appeared at this point in the program. Otherwise, do nothing.


string read-filelist

Load the file named string and attempt to parse it as a list of data using normal syntax parsing rules.

If reading the file fails or contains invalid syntax, raise an error.


abort

Raise an error.


v clonev v

Duplicate the item on top of the stack.

If the stack is empty, raise an error.


int dig → (…)

Shuffle the stack according to int:

  • If int is positive, find the datum at that position in the stack, remove it, and place it on top of the stack.

  • If int is negative, take the item on top of the stack, and insert it so that it is at that position in the stack.

  • If int is 0, do nothing.

Examples
'a 'b 1 dig ; => 'b 'a
10 20 30  2 dig ; => 20 30 10
10 20 30  2 negate dig ; => 30 10 20

1 dig is often abbreviated to swap.


v drop

Remove the item on top of the stack.

If the stack is empty, raise an error.


stack-empty?bool

Place true on top of the stack if the stack is empty; false otherwise.

Data


v symbol?bool

Pushes true on top of the stack if v is a symbol; false otherwise.


v char?bool

Pushes true on top of the stack if v is a character; false otherwise.


v type-ofsymbol

Pushes a symbol representing the type of v.


v datum-describe->stringv string

"Describe" v, using pre-defined means, as a string.


a b equal?bool

Pushes true on top of the stack if a and b are value-equal; false otherwise.

Context


symbol take-definition → (list or false)

If symbol refers to a definition in the current context, remove it and place its definition body on the stack.
The definition will cease to exist.

If no such definition exists, place false on the stack.


symbol resolve-definition → (list or false)

Resolve the definition symbol in the same way that symbols are normally resolved when attempting to execute them, and place its body on the stack.

If no such definition exists, place false on the stack.


list symbol add-definition

Add list as a definition in the current context, named by symbol.


list eval-definition → …

Evaluate list as if it were the body of a named definition.


symbol defined?bool

Determine whether symbol exists in the definition environment for the current context.


defined-nameslist of symbol

Collect all the symbols bound in the definition environment for the current context.


all-builtinslist of symbol

Collect all the names of builtins into a list.


symbol context-set-name

Register symbol as the “name” of the current context.


context-name → (symbol or false)

Get the “name” previously registered to the current context with context-set-name, or false if no such name was registered.


(symbol func) (symbol name) uplevel-in-named-context → …

Like func uplevel, but first traverses up the context stack to find a context with a “name” set to name (registered with context-set-name).

If no such context exists, raise an error.