diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-08-14T09·49+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-08-14T09·49+0000 |
commit | 5cde23f8698e7cdde220f30504b339b7237fd5f2 (patch) | |
tree | cfb1ee84b0353f0204cb153c2e64d1d998a6bc35 /src/fix.cc | |
parent | 0a2de7f543ac23b8576a232c0ecf6a5f49c1884a (diff) |
* Function() takes a list of formals.
Diffstat (limited to 'src/fix.cc')
-rw-r--r-- | src/fix.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/fix.cc b/src/fix.cc index dd02d75387da..5405190f3d6b 100644 --- a/src/fix.cc +++ b/src/fix.cc @@ -53,10 +53,18 @@ static Expr substExpr(string x, Expr rep, Expr e) else return e; - if (ATmatch(e, "Function(<str>, <term>)", &s, &e2)) - if (x == s) - return e; - /* !!! unfair substitutions */ + ATermList formals; + if (ATmatch(e, "Function([<list>], <term>)", &formals, &e2)) { + while (!ATisEmpty(formals)) { + 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. */ @@ -332,6 +340,8 @@ static Expr evalExpr2(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 previously evaluated expressions. */ NormalForms::iterator i = state.normalForms.find(e); |