Created
January 9, 2013 18:10
-
-
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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