29E. Summary


Conceptual lists

In this course, we will use a conceptual list notation where a list of integers is written inside square brackets, as in [4, 2, 9]. The empty list is written [ ]. Operations on conceptual lists include

Write h : t for the list whose head is h and whose tail is t. Do not write [h : t].


Abstract data types

An abstract data type is an interface that contains a type and functions (and sometimes constants) for that type. Conceptual lists are an example of an abstract data type.


Linked lists

Linked lists are a way to implement conceptual lists. An empty list is represented by a null pointer. A nonempty list is represented by a pointer to a structured value of type ListCell that holds the list's head and tail. Type List is the same as ListCell*.

Linked list diagrams are a standard way to draw pictures of linked lists. Diagram

shows the representation of [2, 4, 6] as a linked list.