Skip to content

Instantly share code, notes, and snippets.

@jennifersmith
Created March 3, 2012 21:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jennifersmith/1968416 to your computer and use it in GitHub Desktop.
Save jennifersmith/1968416 to your computer and use it in GitHub Desktop.
(ns clojuredojo.core)
(defn palindrome-detector [thing] (= (reverse thing) (seq thing)) )
(def __ palindrome-detector)
(false? (__ '(1 2 3 4 5)))
(true? (__ "racecar"))
(true? (__ [:foo :bar :foo]))
(true? (__ '(1 1 3 3 1 1)))
(false? (__ '(:a :b :c)))
(defn something [x] (remove coll? (tree-seq coll? vec x)))
(def __ something)
(= (__ '((1 2) 3 [4 [5 6]])) '(1 2 3 4 5 6))
(= (__ ["a" ["b"] "c"]) '("a" "b" "c"))
(= (__ '((((:a))))) '(:a))
(defn treewalker [the-tree]
(odd?
(count (filter (fn [i] (not (false? i))) (flatten the-tree)))))
;; (every? #() (tree-seq seq? vec the-tree) )
(def __ treewalker)
(= (__ '(:a (:b nil nil) nil))
false)
(= (__ '(:a (:b nil nil)))
false)
(= (__ [1 nil [2 [3 nil nil] [4 nil nil]]])
true)
(= (__ [1 [2 nil nil] [3 nil nil] [4 nil nil]])
false)
(= (__ [1 [2 [3 [4 nil nil] nil] nil] nil])
true)
(= (__ [1 [2 [3 [4 false nil] nil] nil] nil])
false)
(= (__ '(:a nil ()))
false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment