chickadee » scheme » base » memv

memq obj listprocedure
memv obj listprocedure
member obj list #!optional compareprocedure

These procedures return the first sublist of list whose car is obj, where the sublists of list are the non-empty lists returned by (list-tail list k) for k less than the length of list. If obj does not occur in list, then #f (not the empty list) is returned. memq uses eq? to compare obj with the elements of list, while memv uses eqv? and member compare if given, and equal? otherwise.

(memq 'a '(a b c))                      ===>  (a b c)
(memq 'b '(a b c))                      ===>  (b c)
(memq 'a '(b c d))                      ===>  #f
(memq (list 'a) '(b (a) c))             ===>  #f
(member (list 'a)
        '(b (a) c))                     ===>  ((a) c)
(memq 101 '(100 101 102))               ===>  unspecified
(memv 101 '(100 101 102))               ===>  (101 102)