Fix persistent state bug preventing to run named sequences and bindings twice

This commit is contained in:
Tissevert 2021-01-06 12:31:12 +01:00
parent a888e1ce70
commit a74b0cc480

View file

@ -18,14 +18,14 @@ function apply(f, x) {
} }
function bind() { function bind() {
var m, steps, i; var m, steps;
if(arguments.length < 1) { if(arguments.length < 1) {
return wrap(); return wrap();
} }
m = arguments[0]; m = arguments[0];
steps = arguments; steps = arguments;
i = 1;
return function(f) { return function(f) {
var i = 1;
var step = function(x) { var step = function(x) {
if(i < steps.length) { if(i < steps.length) {
steps[i++](x)(step); steps[i++](x)(step);
@ -87,8 +87,8 @@ function run() {
function sequence() { function sequence() {
var steps = arguments; var steps = arguments;
var i = 0;
return function(f) { return function(f) {
var i = 0;
var step = function(x) { var step = function(x) {
if(i < steps.length) { if(i < steps.length) {
steps[i++](step); steps[i++](step);