This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see AssociationListsCowan in WG2's repo for R7RS-large.

Association­Lists­Cowan

cowan
2012-12-24 08:41:55
1history
source

This proposal is a tiny extension to SRFI 1 to bring it to parity with Common Lisp.

Association lists

(make-alist keys values)

Returns a newly allocated alist whose pairs are constructed from the elements of the lists keys and values. (Common Lisp PAIRLIS.)

(reverse-assq obj alist)

(reverse-assv obj alist)

(reverse-assoc obj alist [ compare ] )

These procedures find the first pair in alist whose cdr (rather than car) field is obj , and returns that pair. If no pair in alist has obj as its cdr, then #f (not the empty list) is returned. The assq procedure uses eq? to compare obj with the cdr fields of the pairs in alist, while assv uses eqv? and assoc uses compare if given and equal? otherwise. (Common Lisp RASSOC.)