aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-12-12 01:30:09 +0000
committerdos-reis <gdr@axiomatics.org>2011-12-12 01:30:09 +0000
commitc81c34e8a92f6982d761a48cc2b103ce736fbf95 (patch)
treee01f3fb3a6a0b2f0042516a96af4a64c9ecfb6f3 /src/interp
parent2159e0cec3aa62a8822f1f42f0d14b55df445676 (diff)
downloadopen-axiom-c81c34e8a92f6982d761a48cc2b103ce736fbf95.tar.gz
* interp/g-util.boot (liftAassignments!): New.
(splitAssignments!): Use it. * algebra/multpoly.spad.pamphlet (SparseMultivariatePolynomial): Fix thinko.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/g-util.boot15
1 files changed, 13 insertions, 2 deletions
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