doc.txt

list-accessor-predicates: Test whether an accessor can be applied

_list-accessor-predicates_: Test whether an accessor can be applied
===================================================================

By Erich Rast (erich at snafu dot de)

Keywords: _list_, _accessor_, _predicate_, _cadr?_

To use: (require (planet "list-accessor-predicates.ss" ("erast" "list-accessor-predicates.plt" 1 0)))

Provides the missing test functions for common list accessors:

car? ; synonymous to pair?
cdr? ; synonymous to pair?
cadr?
caar?
cdar?
caddr?
cdadr?
.
.
.

All combinations of a nesting up to four are supported. The predicates can be used to test safely whether a respective accessor can be applied to a datum, for example if (cadadr? datum) is #t, (cadadr datum) will not cause an exception.