The Grinnell Scheme Web: The assq
procedure

And I suppose there's an analogue of assoc that uses eq? rather than equal?.

Yes, there is. It's called assq. It takes an object and an association list, and returns the first pair on the association list in which the car is eq? to the object, or #f if there is no such pair:

> (assq #f '((#t . 17) (#f . 39)))
(#f . 39)
> (assq 17  '((#t . 17) (#f . 39)))
#f
> (assq #t '())
#f


Next topic
Previous topic
Table of contents


This document is available on the World Wide Web as

http://www.math.grin.edu/~stone/scheme-web/assq.html


created December 30, 1995
last revised January 3, 1996

Copyright 1995, 1996 by John David Stone (stone@math.grin.edu)