Skip to content

Commit

Permalink
Made function application force until function is a lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Bung committed Mar 13, 2010
1 parent 0933f99 commit efb0752
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions haskell.ast.js
Expand Up @@ -67,9 +67,12 @@
this.func = func;
this.arg = arg;
this.eval = function(env) {
clos = this.func.eval(env);
x = clos.expression.pattern;
body = clos.expression.expression;
var clos = this.func.eval(env);
while (clos.expression.type!="Lambda") {
clos = clos.force();
};
var x = clos.expression.pattern;
var body = clos.expression.expression;
return body.eval(clos.env.substitute(x, new interpreter.Closure(env, this.arg)));
};
};
Expand Down

0 comments on commit efb0752

Please sign in to comment.