The function (some pred lst ) (a standard function in Common Lisp) tests whether some element of lst satisfies the predicate pred. If an element of the list is found for which pred returns a value other than #f, some returns that value.

> (some number? '(a 1 b 2 3 c 4))

> (some symbol? '(a 1 b 2 3 c 4)) #t

> (some string? '(a 1 b 2 3 c 4)) #f

(define (some pred lst)
  (if (pair? lst)
      (or (pred (car lst))
          (some pred (cdr lst)))

Contents    Page-10    Prev    Next    Page+10    Index