diff options
author | Stuart Halloway <stu@thinkrelevance.com> | 2010-05-03 17:42:22 -0400 |
---|---|---|
committer | Stuart Halloway <stu@thinkrelevance.com> | 2010-05-03 17:42:22 -0400 |
commit | 48b81e07256c697c23a1aff896596300e7d0115b (patch) | |
tree | 8e5cb77cde93c05f33b2e7c3afd4a918d433f7ce /src/main/clojure/clojure | |
parent | eb7021af8260c17e29d2653a3de982fb48e1e6c8 (diff) |
put includes? back into the seq namespaces
- seq-contains? is dead in clojure
- includes? is deprecated, but no need to gratuitously break people
Diffstat (limited to 'src/main/clojure/clojure')
-rw-r--r-- | src/main/clojure/clojure/contrib/seq.clj | 8 | ||||
-rw-r--r-- | src/main/clojure/clojure/contrib/seq_utils.clj | 7 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/main/clojure/clojure/contrib/seq.clj b/src/main/clojure/clojure/contrib/seq.clj index 5b335be5..abac65c0 100644 --- a/src/main/clojure/clojure/contrib/seq.clj +++ b/src/main/clojure/clojure/contrib/seq.clj @@ -140,7 +140,13 @@ [pred coll] (for [[idx elt] (indexed coll) :when (pred elt)] idx)) - +(defn includes? + "Returns true if coll contains something equal (with =) to x, + in linear time. Deprecated. prefer 'contains?' for key testing, + or 'some' for ad hoc linear searches." + {:deprecated true} + [coll x] + (boolean (some (fn [y] (= y x)) coll))) diff --git a/src/main/clojure/clojure/contrib/seq_utils.clj b/src/main/clojure/clojure/contrib/seq_utils.clj index 406f0d3e..018fc2e8 100644 --- a/src/main/clojure/clojure/contrib/seq_utils.clj +++ b/src/main/clojure/clojure/contrib/seq_utils.clj @@ -141,6 +141,13 @@ [pred coll] (for [[idx elt] (indexed coll) :when (pred elt)] idx)) +(defn includes? + "Returns true if coll contains something equal (with =) to x, + in linear time. Deprecated. Prefer 'contains?' for key testing, + or 'some' for ad hoc linear searches." + {:deprecated true} + [coll x] + (boolean (some (fn [y] (= y x)) coll))) |