Skip to content
Browse files

* src/cljs/cljs/core.cljs: use satisfies? in nth and reduce. reducibl…

…e? -> reduceable?
  • Loading branch information...
1 parent 1105d86 commit 8159defccf6f6a3ab8b56a6f9f1e4a5c515db27b David Nolen committed May 6, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/cljs/cljs/core.cljs
View
10 src/cljs/cljs/core.cljs
@@ -635,11 +635,11 @@ reduces them without incurring seq initialization"
also works for strings, arrays, regex Matchers and Lists, and,
in O(n) time, for sequences."
([coll n]
- (if (indexed? coll)
+ (if (satisfies? IIndexed coll)
(-nth coll (.floor js/Math n))
(linear-traversal-nth coll (.floor js/Math n))))
([coll n not-found]
- (if (indexed? coll)
+ (if (satisfies? IIndexed coll)
(-nth coll (.floor js/Math n) not-found)
(linear-traversal-nth coll (.floor js/Math n) not-found))))
@@ -750,7 +750,7 @@ reduces them without incurring seq initialization"
"Returns true if coll implements nth in constant time"
[x] (satisfies? IIndexed x))
-(defn ^boolean reducible?
+(defn ^boolean reduceable?
"Returns true if coll satisfies IReduce"
[x] (satisfies? IReduce x))
@@ -973,11 +973,11 @@ reduces them without incurring seq initialization"
applying f to that result and the 2nd item, etc. If coll contains no
items, returns val and f is not called."
([f coll]
- (if (reducible? coll)
+ (if (satisfies? IReduce coll)
(-reduce coll f)
(seq-reduce f coll)))
([f val coll]
- (if (reducible? coll)
+ (if (satisfies? IReduce coll)
(-reduce coll f val)
(seq-reduce f val coll))))

0 comments on commit 8159def

Please sign in to comment.
Something went wrong with that request. Please try again.