Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 863 Bytes

6.md

File metadata and controls

20 lines (13 loc) · 863 Bytes

Part 6: working with lists

This is the last section before we're done implementing the language, and compared to the last part it should be relatively easy.

In Lisp one of the fundamental data structures is the list (the name Lisp is derived from list processing after all). In order to be able to work properly with lists, we'll introduce four new forms into the language:

  • cons is used to construct lists from a "head" element, and the rest of the list (the "tail").
  • head extracts the first element of a list
  • tail returns the rest of the elments, once the first is dropped.
  • empty takes a list as input, and returns #t if it is empty and #f otherwise.

Go on, then, finish your language.

mvn -Dtest=ListTest test

What's next?

With the language implementation done, it's time to use our language in part 7.