forked from lix-project/lix
* Function() takes a list of formals.
This commit is contained in:
parent
0a2de7f543
commit
5cde23f869
18
src/fix.cc
18
src/fix.cc
|
@ -53,10 +53,18 @@ static Expr substExpr(string x, Expr rep, Expr e)
|
||||||
else
|
else
|
||||||
return e;
|
return e;
|
||||||
|
|
||||||
if (ATmatch(e, "Function(<str>, <term>)", &s, &e2))
|
ATermList formals;
|
||||||
if (x == s)
|
if (ATmatch(e, "Function([<list>], <term>)", &formals, &e2)) {
|
||||||
return e;
|
while (!ATisEmpty(formals)) {
|
||||||
/* !!! unfair substitutions */
|
if (!ATmatch(ATgetFirst(formals), "<str>", &s))
|
||||||
|
throw badTerm("not a list of formals", (ATerm) formals);
|
||||||
|
if (x == (string) s)
|
||||||
|
return e;
|
||||||
|
formals = ATgetNext(formals);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ??? unfair substitutions? */
|
||||||
|
|
||||||
/* Generically substitute in subterms. */
|
/* Generically substitute in subterms. */
|
||||||
|
|
||||||
|
@ -332,6 +340,8 @@ static Expr evalExpr2(EvalState & state, Expr e)
|
||||||
|
|
||||||
static Expr evalExpr(EvalState & state, Expr e)
|
static Expr evalExpr(EvalState & state, Expr e)
|
||||||
{
|
{
|
||||||
|
Nest nest(lvlVomit, format("evaluating expression: %1%") % printTerm(e));
|
||||||
|
|
||||||
/* Consult the memo table to quickly get the normal form of
|
/* Consult the memo table to quickly get the normal form of
|
||||||
previously evaluated expressions. */
|
previously evaluated expressions. */
|
||||||
NormalForms::iterator i = state.normalForms.find(e);
|
NormalForms::iterator i = state.normalForms.find(e);
|
||||||
|
|
Loading…
Reference in a new issue