Skip to content

Commit

Permalink
* persistent-vector.js: fix bug, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
David Nolen committed Mar 3, 2012
1 parent e656b7d commit 2ef1064
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions persistent-vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PersistentVector.prototype = {
newTail[i & 0x01f] = val;
return new PersistentVector(this.cnt, this.shift, this.root, newTail);
}
return new PersistentVector(this.cnt, this.shift, this.doAssoc(shift, root, i, val), this.tail);
return new PersistentVector(this.cnt, this.shift, this.doAssoc(this.shift, this.root, i, val), this.tail);
}
if(i === this.cnt) {
return this.cons(val);
Expand Down Expand Up @@ -174,9 +174,6 @@ time(function() {
for(var i = 0; i < 1000000; i++) {
v = v.cons(i);
}
console.log("size:", v.count());
console.log("val at front", v.nth_1(0));
console.log("val at end", v.nth_1(999999));
for(var i = 0; i < 1000000; i++) {
v.nth_1(999999);
}
Expand All @@ -196,9 +193,6 @@ time(function() {
for(var i = 0; i < 1000000; i++) {
a.push(i);
}
console.log("size:", a.length);
console.log("val at front", a[0]);
console.log("val at end", a[999999]);
});
time(function() {
for(var i = 0; i < 1000000; i++) {
Expand Down

0 comments on commit 2ef1064

Please sign in to comment.