Next: , Previous: SRFI-1 Deleting, Up: SRFI-1


39.3.9 Association Lists

Association lists are described in detail in section Association Lists. The present section only documents the additional procedures for dealing with association lists defined by SRFI-1.

— Scheme Procedure: assoc key alist [=]

Return the pair from alist which matches key. Equality is determined by =, which defaults to equal? if not given. alist must be an association lists—a list of pairs.

— Scheme Procedure: alist-cons key datum alist

Equivalent to

          (cons (cons key datum) alist)

This procedure is used to cons a new pair onto an existing association list.

— Scheme Procedure: alist-copy alist

Return a newly allocated copy of alist, that means that the spine of the list as well as the pairs are copied.

— Scheme Procedure: alist-delete key alist [=]
— Scheme Procedure: alist-delete! key alist [=]

Return a list containing the pairs of alist, but without the pairs whose cars are equal to key. Equality is determined by =, which defaults to equal? if not given.

alist-delete! is allowed, but not required to modify the structure of the list alist in order to produce the result.