Created
March 8, 2021 18:54
-
-
Save mkumm/0a397f5df9d18139bccb55e9e07b1a03 to your computer and use it in GitHub Desktop.
Scheme for Chapter 2 - The Little Schemer
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
#lang Scheme | |
(define atom? | |
(λ (x) | |
(and (not (pair? x)) (not (null? x))))) | |
(define lat? | |
(λ (l) | |
(cond | |
((null? l) #t) | |
((atom? (car l)) (lat? (cdr l))) | |
(else #f)))) | |
(define member? | |
(λ (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