diff options
author | Chouser <chouser@n01se.net> | 2008-10-05 17:19:26 +0000 |
---|---|---|
committer | Chouser <chouser@n01se.net> | 2008-10-05 17:19:26 +0000 |
commit | 2d5f5de88c91b56cd9b7103a6750091774801ce1 (patch) | |
tree | f05cc83245b7aafbcb86ba71ca91e617c9a2ed16 /clojurescript | |
parent | 9513e80be4182da585cbba18d63f19fcde85fc01 (diff) |
ClojureScript: fix ArraySeq.reduce
Diffstat (limited to 'clojurescript')
-rw-r--r-- | clojurescript/clj.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clojurescript/clj.js b/clojurescript/clj.js index 7e889db6..6ea65017 100644 --- a/clojurescript/clj.js +++ b/clojurescript/clj.js @@ -313,6 +313,8 @@ clojure = new clojure.lang.Namespace({ isPos: function(x) { return x > 0; }, lt: function(x,y) { return x < y; }, gt: function(x,y) { return x > y; }, + minus: function(x,y) { return x - y; }, + add: function(x,y) { return x + y; }, inc: function(x) { return x + 1; }, dec: function(x) { return x - 1; }, unchecked_inc: function(x) { return x + 1; } @@ -371,6 +373,9 @@ clojure = new clojure.lang.Namespace({ intCast: function(i) { return parseInt(i); }, + makeStringBuilder: function(s) { + return new clojure.JS.StringBuilder( s===undefined ? "" : s ); + } } } }); @@ -496,7 +501,7 @@ clojure.JS.defclass( clojure.lang, "ArraySeq", { return new clojure.lang.ArraySeq( _meta, this.array, this.i, this.len ); }, reduce: function( fn, start ) { - var ret = (start === undefined) ? this.a[0] : fn(start, this.a[0]); + var ret = (start===undefined) ? this.a[this.i] : fn(start,this.a[this.i]); for( var x = this.i + 1; x < this.len; ++x ) { ret = fn( ret, this.a[x] ); } |