Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

don't extend string and array to ISeqable, change seq to deal with

them if satisfies? ISeqable fails
  • Loading branch information...
commit e63af51e812b9e11139f2f3ef0a599320cff1c75 1 parent b0792ff
@swannodette swannodette authored
Showing with 12 additions and 9 deletions.
  1. +12 −9 src/cljs/cljs/core.cljs
View
21 src/cljs/cljs/core.cljs
@@ -376,9 +376,18 @@
Strings."
[coll]
(when-not (nil? coll)
- (if (satisfies? ASeq coll)
- coll
- (-seq coll))))
+ (cond
+ (satisfies? ISeqable coll)
+ (-seq coll)
+
+ ^boolean (goog.isArray coll)
+ (array-seq coll 0)
+
+ (and ^boolean (goog.isString coll)
+ (not (keyword? coll)))
+ (prim-seq coll 0)
+
+ :else (throw (js/Error. (str coll "is not ISeqable"))))))
(defn first
"Returns the first item in the collection. Calls seq on its
@@ -698,9 +707,6 @@ reduces them without incurring seq initialization"
(prim-seq array i)))
(extend-type array
- ISeqable
- (-seq [array] (array-seq array 0))
-
ICounted
(-count [a] (alength a))
@@ -1913,9 +1919,6 @@ reduces them without incurring seq initialization"
IHash
(-hash [o] (goog.string/hashCode o))
- ISeqable
- (-seq [string] (prim-seq string 0))
-
ICounted
(-count [s] (alength s))
Please sign in to comment.
Something went wrong with that request. Please try again.