Skip to content

Commit

Permalink
removed seq-contains?
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed May 1, 2010
1 parent 423e0b7 commit 7b4b8e1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
11 changes: 1 addition & 10 deletions src/clj/clojure/core.clj
Expand Up @@ -1017,8 +1017,7 @@
returns false. Note that for numerically indexed collections like
vectors and Java arrays, this tests if the numeric key is within the
range of indexes. 'contains?' operates constant or logarithmic time;
it will not perform a linear search for a value. See also
'seq-contains?' and 'some'."
it will not perform a linear search for a value. See also 'some'."
[coll key] (. clojure.lang.RT (contains coll key)))

(defn get
Expand Down Expand Up @@ -5115,14 +5114,6 @@
[coll]
(nth coll (rand-int (count coll))))

(defn seq-contains?
"Returns true if sequential search of coll contains something equal (with =) to x,
in linear time."
{:added "1.2"}
[coll x]
(if (some (fn [y] (= y x)) coll)
true false))

(defn partition-all
"Returns a lazy sequence of lists like partition, but may include
partitions with fewer than n items at the end."
Expand Down
4 changes: 0 additions & 4 deletions test/clojure/test_clojure/sequences.clj
Expand Up @@ -1147,10 +1147,6 @@
(let [elt (rand-nth [:a :b :c :d])]
(is (#{:a :b :c :d} elt))))

(deftest test-seq-contains?
(is (seq-contains? [1 2 3 4 5] 5))
(is (not (seq-contains? [1 2 3 4 5] 6))))

(deftest test-partition-all
(is (= (partition-all 4 [1 2 3 4 5 6 7 8 9])
[[1 2 3 4] [5 6 7 8] [9]]))
Expand Down

0 comments on commit 7b4b8e1

Please sign in to comment.