Skip to content

Latest commit

 

History

History
15 lines (9 loc) · 736 Bytes

4.md

File metadata and controls

15 lines (9 loc) · 736 Bytes

Part 4: working with variables

So far, our interpreted language is only able do deal with expressions one by one. In a real programming language, we need to be able to store intermediate results in variables, and then later to look them up from the environment.

We will start by implementing the Environment class (which can be found in diylisp/types.py). Then we'll extend evaluate to handle expressions using defined variables, and the creation of new variables with the define form.

Run the tests, and get going!

nosetests tests/test_4_working_with_variables_and_environments.py --stop

What's next?

In part 5 the environments we just implemented enable us to make lexically scoped functions.