lenv.h file

Contents

Functions

auto lenv_new(void) -> lenv*
Constructs a new lenv.
void lenv_del(lenv* env)
Destroys the lenv env.
auto lenv_get(lenv* env, const lval* key) -> lval*
Gets an lval from an lenv.
auto lenv_copy(const lenv* env) -> lenv*
TODO.
void lenv_put(lenv* env, const lval* key, lval* value)
Sets an lval in an lenv.
void lenv_def(lenv* env, const lval* key, lval* value)
TODO.
void lenv_add_builtin(lenv* env, const char* name, lbuiltin func)
Adds a builtin function to the environment.
void lenv_add_builtins(lenv* env)
Adds all the builtin functions to the environment.

Function documentation

lenv* lenv_new(void)

Constructs a new lenv.

Returns lenv*

Constructs a new lenv.

void lenv_del(lenv* env)

Destroys the lenv env.

Destroys the lenv env by freeing all of its entries.

lval* lenv_get(lenv* env, const lval* key)

Gets an lval from an lenv.

Returns lval*

Returns a copy of the lval k from the lenv env if it exists otherwise returns an error.

void lenv_put(lenv* env, const lval* key, lval* value)

Sets an lval in an lenv.

Sets an lval in an lenv. Replaces any existing entry with the same key.

void lenv_add_builtin(lenv* env, const char* name, lbuiltin func)

Adds a builtin function to the environment.

Parameters
env
name - type: char*
func

Adds a builtin function to the environment with the name name and the function signature func.

void lenv_add_builtins(lenv* env)

Adds all the builtin functions to the environment.

Adds all the builtin functions to the environment.