Created
June 14, 2011 15:09
-
-
Save soofaloofa-zz/1025086 to your computer and use it in GitHub Desktop.
2. Do It, Do It Again, and Again, and Again ...
This file contains 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
(defn atom? [x] | |
(not (seq? x))) | |
(defn lat? [x] | |
(loop [l x] | |
(cond | |
(empty? l) true | |
(atom? (first l)) (recur (last l)) | |
:else false))) | |
(defn member? [atom lat] | |
(loop [a atom l lat] | |
(cond | |
(empty? l) false | |
:else (or (= (first l) a) | |
(recur a (rest l)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clojure functions for Chapter 2 of The Little Schemer.