-
-
Save klandergren/1035005 to your computer and use it in GitHub Desktop.
Does alist contain x?
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
| ;; think on this: | |
| ;; contains-incomplete returns 0 if it doesn't find | |
| ;; the val and greater than 0 if it does | |
| (define (contains-incomplete val list) | |
| (fold-left (lambda (a x) (YOUR CODE) 0 list)) | |
| ;; testing | |
| (contains-incomplete 0 '(1 2 3)) ;; => 0 | |
| (contains-incomplete 1 '(1 2 3)) ;; => 1 | |
| (contains-incomplete 2 '(1 2 3)) ;; => 1 | |
| (contains-incomplete 3 '(1 2 3)) ;; => 1 | |
| (RESTART 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment