Memq

(memq object list) -> list or #f

Returns the first sublist of list that has a car eq? to object. If no sublist meeting this criterion is found, #f is returned.

Memq comes from the R5RS standard for Scheme.

Examples:

>>(memq 'alpha '(alpha bravo charlie))
:: (alpha bravo charlie)
>>(memq 'medium '(small medium large))
:: (medium large)
>>(memq "a" '("a" "b" "c" "d"))
:: #f

(Why? See eq?)

>>(memq '(a) '(b (a) c))
:: #f
>>(memq 101 '(100 101 102))
:: (101 102)

See Also: eq?