@@ -50,9 +50,9 @@ var Elm = function() {
50 args[i].kids.push(this);
50 args[i].kids.push(this);
53− var fold = function(func,base,input) {
53+ var fold = function(func,base,baseIsFunc,input) {
54 this.id = Guid.guid();
54 this.id = Guid.guid();
55− this.value = base;
55+ this.value = baseIsFunc ? base(input.value) : base;
56 this.kids = [];
56 this.kids = [];
57 this.recv = function(timestep, changed, parentID) {
57 this.recv = function(timestep, changed, parentID) {
58 if (changed) { this.value = func(input.value)(this.value); }
58 if (changed) { this.value = func(input.value)(this.value); }
@@ -113,7 +113,8 @@ var Elm = function() {
114 return {Input: function(x) {return new input(x);},
114 return {Input: function(x) {return new input(x);},
115 Lift: function(f,xs){return new lift(f,xs);},
115 Lift: function(f,xs){return new lift(f,xs);},
116− Fold: function(f,b,x){return new fold(f,b,x);},
116+ Fold: function(f,b,x){return new fold(f,b,false,x);},
117+ Fold1: function(f,b,x){return new fold(f,b,true,x);},
117 keepIf : function(pred) { return function(base) { return function(sig) {
118 keepIf : function(pred) { return function(base) { return function(sig) {
118 return new dropIf(function(x) { return !pred(x)},base,sig); }; }; },
119 return new dropIf(function(x) { return !pred(x)},base,sig); }; }; },
119 dropIf : function(pred) { return function(base) { return function(sig) {
120 dropIf : function(pred) { return function(base) { return function(sig) {