                (recur nval (inc n))))
            val)))))
 
-(declare hash-coll cons pr-str counted? RSeq)
+(declare hash-coll cons pr-str RSeq)
+
+(defn ^boolean counted?
+  "Returns true if coll implements count in constant time"
+  [x] (satisfies? ICounted x))
+
+(defn ^boolean indexed?
+  "Returns true if coll implements nth in constant time"
+  [x] (satisfies? IIndexed x))
 
 (deftype IndexedSeq [a i]
   Object

  [coll]
  (-empty coll))

(declare counted?)

(defn- accumulating-seq-count [coll]
  (loop [s (seq coll) acc 0]
    (if (counted? s) ; assumes nil is counted, which it currently is

(defn find
  "Returns the map entry for key, or nil if key not present."
  [coll k]
  (when (and (not (nil? coll))
             (associative? coll)
             (contains? coll k))
    [k (-lookup coll k)]))
