Lispex v0.1.0 Env View Source

This is the Environment module. Used by the Eval module to evaluate the scheme code. Contains the definition for Scheme constructs in a Map .

Link to this section Summary

Functions

Fetches the value for the given key from the supplied environment

Creates a new environment map

Inserts a key value pair in the current environment and returns it

Link to this section Functions

Fetches the value for the given key from the supplied environment

Parameters

k : Key env : A Map which represents the current environment.

Example

iex> Env.get(:a, env)
5

Creates a new environment map.

Returns Map

Parameters

  • outer : A Map which represents the outer Environment. Default value nil for this optional parameter.

Example

iex> Env.new_env()
%{}

Inserts a key value pair in the current environment and returns it.

Returns Map

Parameters

  • k : Key
  • v : Value
  • env : A Map which represents the current environment.

Example

iex> Env.put(:a, 5, %{ })
%{:a : 5}