Skip to content

Instantly share code, notes, and snippets.

@soofaloofa-zz
Created June 14, 2011 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soofaloofa-zz/1025086 to your computer and use it in GitHub Desktop.
Save soofaloofa-zz/1025086 to your computer and use it in GitHub Desktop.
2. Do It, Do It Again, and Again, and Again ...
(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))))))
@soofaloofa-zz
Copy link
Author

Clojure functions for Chapter 2 of The Little Schemer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment