Skip to content

Latest commit

 

History

History
21 lines (12 loc) · 937 Bytes

5.md

File metadata and controls

21 lines (12 loc) · 937 Bytes

Part 5: functions

This part is the one you might have been waiting for. It's time to add functions to our little language.

Functions are created with the lambda form, which returns an instance of Closure (find the class definition in diylisp/types.py). The first few tests guide you to implement the lambda form correctly.

The next tests concern calling functions. A function call happens when we evaluate a list in which the first element is a function closure.

Finally, we handle some situations where function calls are done incorrectly, and make sure we give appropriate errors.

Make it happen!

This is probably the most difficult part of making the language, so don't worry if it takes a bit longer than the previous parts.

nosetests tests/test_5_adding_functions_to_the_mix.py --stop

What's next?

Ready for the last part of the language? In part 6 we add a ways to work with lists.