aboutsummaryrefslogtreecommitdiff
path: root/src/clojure/contrib/seq_utils.clj
diff options
context:
space:
mode:
authorAaron Bedra and Stuart Halloway <pair@thinkrelevance.com>2009-08-25 21:11:59 -0400
committerAaron Bedra and Stuart Halloway <pair@thinkrelevance.com>2009-08-25 21:11:59 -0400
commit1640c0433e35cf9a60e1483424c0a2a8ca56b730 (patch)
tree9ca74826e518cef7cccbdfe509c93babc4b69867 /src/clojure/contrib/seq_utils.clj
parent3a220e3af24bd5bd30869a112c7210a888ea6dc4 (diff)
positions takes only a predicate, per Rich's feedback
Diffstat (limited to 'src/clojure/contrib/seq_utils.clj')
-rw-r--r--src/clojure/contrib/seq_utils.clj16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/clojure/contrib/seq_utils.clj b/src/clojure/contrib/seq_utils.clj
index 5f3b7446..ad913f70 100644
--- a/src/clojure/contrib/seq_utils.clj
+++ b/src/clojure/contrib/seq_utils.clj
@@ -211,20 +211,12 @@
(cons (if (identical? x NIL) nil x)
(drain))))))))))
-(defmulti positions
- "Returns a lazy sequence containing the positions at which item
- is found in coll. Functions (responding true to fn?) are called
- against members of the collection, other items are compared for
- equality."
- { :arglists '([item-or-pred coll]) }
- (fn [item-or-pred _]
- (if (fn? item-or-pred) :pred :item)))
-
-(defmethod positions :pred [pred coll]
+(defn positions
+ "Returns a lazy sequence containing the positions at which pred
+ is true for items in coll."
+ [pred coll]
(for [[idx elt] (indexed coll) :when (pred elt)] idx))
-(defmethod positions :item [item coll]
- (for [[idx elt] (indexed coll) :when (= item elt)] idx))