next up previous contents
Next: The Empty List Up: How to construct/deconstruct Previous: List Construction:

Bigger Chunks:

it is possible to add (or take away) bigger chunks onto (from) the front of a list than one element at a time. The list notation allows for this. Suppose you want to stick the elements a, b and c onto the front of the list X to make a new list Y. then this can be done with Y=[a,b,cX].

Conversely, suppose you want to take three elements off the front of a list X in such a way that the remaining list, Y, is available for use. This can be done with X=[A,B,CY]

A limitation of this approach is that there is no direct way of evading specifying how many elements to attach/ rip off. Using the list notation, there is no way of saying ``rip off N elements of this list X and call the remainder Y''. This has to be done by writing a program and since this is very straightforward, this limitation is not a severe one ---but, see later.

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