diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/algebra/multpoly.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/interp/g-util.boot | 15 |
3 files changed, 21 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f425c99a..e611f359 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2011-12-11 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/g-util.boot (liftAassignments!): New. + (splitAssignments!): Use it. + * algebra/multpoly.spad.pamphlet (SparseMultivariatePolynomial): + Fix thinko. + +2011-12-11 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/g-opt.boot (inlineLocals!): Single-used temporaries should go. (spliceSeqArgs): Splice sequences drapped in %scope cloths too. diff --git a/src/algebra/multpoly.spad.pamphlet b/src/algebra/multpoly.spad.pamphlet index b0a45dfc..ecd17271 100644 --- a/src/algebra/multpoly.spad.pamphlet +++ b/src/algebra/multpoly.spad.pamphlet @@ -573,7 +573,7 @@ SparseMultivariatePolynomial(R: Ring,VarSet: OrderedSet): C == T where nlvar := sort(#1 > #2,Lvar) nlpval := Lvar = nlvar => Lpval - nlpval := [Lpval.position(mvar,Lvar) for mvar in nlvar] + [Lpval.position(mvar,Lvar) for mvar in nlvar] evalSortedVarlist(p,nlvar,nlpval) eval(p,Lvar,Lval) == diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 3b1782f9..b8e32570 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -87,9 +87,20 @@ splitAssignments! u == main(u,nil) where v is ['%LET,y,.] => second(u.args) := y [:main(v,l),v] - l + [:liftAssignments! v,:l] l +liftAssignments! x == + x is ['%call,:.] => [:lift! for args in tails x.args] where + lift!() == + s := first args + atomic? s => nil + s is ['%LET,y,:.] => + args.first := y + [:splitAssignments! s,s] + splitAssignments! s + splitAssignments! x + ++ We have a list `l' of expressions to be executed sequentially. ++ Splice in any directly-embedded sequence of expressions. ++ NOTES: This function should not be called on any program with @@ -107,7 +118,7 @@ spliceSeqArgs l == stmts := spliceSeqArgs [:ys,z] lastNode(stmts).rest := spliceSeqArgs rest l stmts - s is ['%LET,:.] and (stmts := splitAssignments! s) => + s is [op,:.] and op in '(%LET %call) and (stmts := liftAssignments! s) => lastNode(stmts).rest := [s,:spliceSeqArgs rest l] stmts rest l = nil => l |