next up previous contents
Next: List Destruction: Up: Lists Previous: Lists

How to construct/deconstruct a list

Given an arbitrary list, we need ways of adding to it and taking it apartgif.

The basic approach provides a simple way of splitting a list into two bits: the first element (if there is one!) and the rest of the list. The corresponding way of joining two bits to form a list requires taking an element and a list and inserting the element at the front of the list.

Paul Brna
Mon May 24 20:14:48 BST 1999