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
. 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.
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.
mvn test=FunctionsTest test
Ready for the last part of the language? In part 6 we add a ways to work with lists.