16.  Pairs and Lists  

(cons obj1 obj2)

See R^4RS.

(car pair)
(cdr pair)

See R^4RS.

(cxr pair pattern)

pattern is either a symbol or a string consisting of a combination of the characters `a' and `d'. It encodes a sequence of car and cdr operations; each `a' denotes the application of car, and each `d' denotes the application of cdr. For example, (cxr p "ada") is equivalent to (cadar p).

(caar pair)
...

(cddddr pair)

See R^4RS.

(set-car! pair obj)
(set-cdr! pair obj)

See R^4RS.
Both procedures return obj.

(make-list k obj)

Returns a list of length k initialized with obj.
Examples:

(make-list 0 'a)                 ==>  ()
(make-list 2 (make-list 2 1))    ==>  ((1 1) (1 1))

(list obj ...)

See R^4RS.

(length list)

See R^4RS.

(list-ref list k)

See R^4RS.

(list-tail list k)

See R^4RS.

(last-pair list)

See R^4RS.

(append list ...)

See R^4RS.

(append! list ...)

Like append, except that the original arguments are modified (destructive append). The cdr of each argument is changed to point to the next argument.
Examples:

(define x '(a b))
(append x '(c d))                ==>  (a b c d)
x                                ==>  (a b)
(append! x '(c d))               ==>  (a b c d)
x                                ==>  (a b c d)

(reverse list)

See R^4RS.

(reverse! list)

Destructive reverse.

(memq obj list)
(memv obj list)
(member obj list)

See R^4RS.

(assq obj alist)
(assv obj alist)
(assoc obj alist)

See R^4RS.

(null? obj)
(pair? obj)

See R^4RS.

(list? obj)

See R^4RS.


Markup created by unroff 1.0,    September 24, 1996,    net@informatik.uni-bremen.de