From c81c34e8a92f6982d761a48cc2b103ce736fbf95 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 12 Dec 2011 01:30:09 +0000 Subject: * interp/g-util.boot (liftAassignments!): New. (splitAssignments!): Use it. * algebra/multpoly.spad.pamphlet (SparseMultivariatePolynomial): Fix thinko. --- src/ChangeLog | 7 +++++++ src/algebra/multpoly.spad.pamphlet | 2 +- src/interp/g-util.boot | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f425c99a..e611f359 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-12-11 Gabriel Dos Reis + + * interp/g-util.boot (liftAassignments!): New. + (splitAssignments!): Use it. + * algebra/multpoly.spad.pamphlet (SparseMultivariatePolynomial): + Fix thinko. + 2011-12-11 Gabriel Dos Reis * interp/g-opt.boot (inlineLocals!): Single-used temporaries should go. 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 -- cgit v1.2.3