t3x.org / sketchy / library / member.html
SketchyLISP
Reference
  Copyright (C) 2006
Nils M Holm

member

Conformance: R5RS

Purpose: Check whether a list has a member that is equal to a given S-expression. If such a member exists, return the tail of the list beginning with that member. If no such member is found, return #f.

Arguments:
X - expression to find
A - list

Model:

(define (member x a)
  (cond ((null? a) #f)
    ((equal? (car a) x) a)
    (#t (member x (cdr a)))))

Implementation:

(define (member x a)
  (letrec
    ((_member (lambda (a)
      (cond ((null? a) #f)
        ((equal? (car a) x) a)
        (#t (_member (cdr a)))))))
    (_member a)))

Example:

(member '(c d) '(a b (c d) e f)) 
=> ((c d) e f)

See also:
memq, assoc.