ExLisp.Env (exlisp v0.1.2)

Copy Markdown

Module managing global environments (variables and functions) for ExLisp. Uses :persistent_term to hold and reference values and functions across sessions with extreme speed.

Summary

Functions

Executes a registered function.

Sets a variable only if unbound (for defvar). Takes a value-computing function and evaluates it only when unbound. Returns the symbol name.

Deletes a function (for fmakunbound).

Deletes a macro.

Deletes a variable.

Prepares the ETS history table and verifies code paths for compiled BEAM modules (initial run only).

Gets a registered function.

Gets history code string for the specified index (or negative relative index).

Gets evaluation result for the specified index (or negative relative index).

Returns the process dictionary value (after setq modification) or default value for a lexical variable.

Gets a registered macro function.

Gets the value of a variable. Raises RuntimeError when unbound.

Checks whether a function is defined.

Checks whether a macro is defined.

Checks whether a variable is bound.

Normalizes symbol names to lowercase atoms.

Dynamically binds variables (for progv).

Registers a function (for defun). Returns the function name.

Registers a macro function (for defmacro). Returns the macro name.

Sets a variable (for defparameter). Always overwrites with the new value. Returns the symbol name.

Sets a variable only if unbound (for defvar). Returns the symbol name.

Records REPL input expression and evaluation result in history table. Also updates Common Lisp special variables (, , , +, ++, +++).

Registers a method for a generic function. Dispatches according to argument type list.

Initializes and clears the environment (variables, functions, and history).

Sets a lexical variable in the process dictionary and returns the assigned value (for setq / setf).

Sets a variable and returns the assigned value (for setq / setf).

Temporarily binds special (dynamically scoped) variables, executes function, and restores previous state upon exit.

Functions

call_fun(name, args)

Executes a registered function.

defvar_lazy(name, val_fn)

Sets a variable only if unbound (for defvar). Takes a value-computing function and evaluates it only when unbound. Returns the symbol name.

delete_fun(name)

Deletes a function (for fmakunbound).

delete_macro(name)

Deletes a macro.

delete_var(name)

Deletes a variable.

ensure_env()

Prepares the ETS history table and verifies code paths for compiled BEAM modules (initial run only).

get_fun(name)

Gets a registered function.

get_history_code(n \\ -1)

Gets history code string for the specified index (or negative relative index).

get_history_result(n \\ -1)

Gets evaluation result for the specified index (or negative relative index).

get_lexical_or_default(var_name, default_val)

Returns the process dictionary value (after setq modification) or default value for a lexical variable.

get_macro(name)

Gets a registered macro function.

get_var(name)

Gets the value of a variable. Raises RuntimeError when unbound.

has_fun?(name)

Checks whether a function is defined.

has_macro?(name)

Checks whether a macro is defined.

has_var?(name)

Checks whether a variable is bound.

keyword?(atom)

normalize_name(name)

Normalizes symbol names to lowercase atoms.

progv(symbols, values, fun)

Dynamically binds variables (for progv).

put_fun(name, fun)

Registers a function (for defun). Returns the function name.

put_macro(name, macro_fun)

Registers a macro function (for defmacro). Returns the macro name.

put_var(name, value)

Sets a variable (for defparameter). Always overwrites with the new value. Returns the symbol name.

put_var_if_unbound(name, value)

Sets a variable only if unbound (for defvar). Returns the symbol name.

record_history(code, result)

Records REPL input expression and evaluation result in history table. Also updates Common Lisp special variables (, , , +, ++, +++).

register_keyword(atom)

register_method(name, types, fun)

Registers a method for a generic function. Dispatches according to argument type list.

register_method(name, qualifier, types, fun)

reset()

Initializes and clears the environment (variables, functions, and history).

set_lexical_var(name, value)

Sets a lexical variable in the process dictionary and returns the assigned value (for setq / setf).

set_var(name, value)

Sets a variable and returns the assigned value (for setq / setf).

with_special_bindings(bindings_list, fun)

Temporarily binds special (dynamically scoped) variables, executes function, and restores previous state upon exit.