University of Washington • CSE583 • D. Notkin © 2000
41
Example: a find functional with a comparison parameter
l(define (find pred-fn x)
  (if (null? x) #f
    (if (pred-fn (car x)) (car x)
        (find pred-fn (cdr x))))) lpred-fn is a parameter that must be a function l(define (is-positive? n) (> n 0))
(find is-positive? ‘(-3 –4 5 7)) ® 5
l(find pair? ‘(3 (4 5) 6)) ® (4 5)
l