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

memp

Conformance: R5.91RS Scheme

Purpose: Extract the tail of a list whose first member has a given property. The property is expressed using a predicate. Evaluate to #f if no member satisfying the predicate exists.

Arguments:
P - predicate
A - list

Implementation:

(define (memp p a)
  (cond ((null? a) #f)
    ((p (car a)) a)
    (else (memp p (cdr a)))))

Example:

(memp pair? '(a b c (x . y) d e f)) 
=> ((x . y) d e f)

See also:
member, memq, memv, remp, assp.