Skip to content

Instantly share code, notes, and snippets.

@kaosf
Created February 15, 2014 08:26
Show Gist options
  • Save kaosf/9016141 to your computer and use it in GitHub Desktop.
Save kaosf/9016141 to your computer and use it in GitHub Desktop.
(defn exists? [l x]
(> (.indexOf l x) -1))
(require '[clojure.test :refer :all])
(testing "exists?"
(is (exists? [1 2 3] 1))
(is (exists? [1 2 3] 2))
(is (not (exists? [1 2 3] 0))))
; ref. http://stackoverflow.com/questions/3249334/test-whether-a-list-contains-a-specific-value-in-clojure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment