Skip to content

Instantly share code, notes, and snippets.

@tcdowney
Created January 9, 2013 18:10
Show Gist options
  • Select an option

  • Save tcdowney/4495393 to your computer and use it in GitHub Desktop.

Select an option

Save tcdowney/4495393 to your computer and use it in GitHub Desktop.
The definition for member? for The Little Schemer. Returns #t if the first argument (an atom) is found in the second argument (a list of atoms).
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a) (member? a (cdr lat)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment