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.

Source for wiki AssociationListsCowan version 1

author

cowan

comment


    

ipnr

74.68.121.27

name

AssociationListsCowan

readonly

0

text

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.)

time

2012-12-24 08:41:55

version

1