The Grinnell Scheme Web: Access procedures
for nested structures

Since pairs can contain other pairs, you could build large data structures out of pairs. Are there any other procedures for recovering parts of such data structures?

Yes, twenty-eight others in all:

Each of these procedures takes a pair as its argument and searches through one, two, or three layers of nesting of pairs within pairs to recover a component at a specified position in the data structure. In the name of each procedure, the letters between the initial c and the final r are a mnemonic for the sequence of nested calls to car and cdr that would be needed to bring out the same element -- for instance, (caaddr pr) yields the same result as (car (car (cdr (cdr pr)))).

Do I really have to read about every one of these?

For convenience of reference, I've included a page about each one. But reading them all would be too much like traversing a maze of twisty little passages, each one slightly different. You might look at a couple; as soon as you get the idea, follow the ``Next major topic'' link.


caar and other access procedures
Next major topic
Previous topic
Table of contents


This document is available on the World Wide Web as

http://www.math.grin.edu/~stone/scheme-web/cxr.html


created August 5, 1995
last revised December 26, 1995

Copyright 1995 by John David Stone (stone@math.grin.edu)