aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/interp/g-opt.boot12
2 files changed, 15 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e797f8b9..4145348c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
2013-05-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ * interp/g-opt.boot (quoteMode): New.
+ (optRetract): Use it.
+ (optPullback): Likewise.
+
+2013-05-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
* interp/define.boot (checkAndDeclare): Constructor parameter
shadowing.
* algebra/lodof.spad.pamphlet (SetOfMIntegersInOneToN): [enum]:
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index c65dcf2d..df9d1e75 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -805,17 +805,23 @@ optList form ==
literalElts is "failed" => form
quote literalElts
+quoteMode x ==
+ x isnt [.,:.] => x
+ ident? x.op and constructor? x.op =>
+ ['%list,quote x.op,:[quoteMode a for a in x.args]]
+ [quoteMode y for y in x]
+
++ Translate retraction of a value denoted by `e' to sub-domain `m'
++ defined by predicate `pred',
optRetract ["%retract",e,m,pred] ==
e isnt [.,:.] =>
cond := simplifyVMForm substitute(e,"#1",pred)
cond is '%true => e
- ['%when,[cond,e],['%otherwise,['moanRetract,e,MKQ m]]]
+ ['%when,[cond,e],['%otherwise,['moanRetract,e,quoteMode m]]]
g := gensym()
['%bind,[[g,e]],
['%when,[substitute(g,"#1",pred),g],
- ['%otherwise,['moanRetract,g,MKQ m]]]]
+ ['%otherwise,['moanRetract,g,quoteMode m]]]]
++ We have an expression `x' of some Union type. Expand an attempted
++ pullback to the `n'th branch of type `t'.
@@ -825,7 +831,7 @@ optPullback ['%pullback,x,t,n] ==
gensym()
expr :=
['%when,[['%ieq,['%head,y],n],['%tail,y]],
- ['%otherwise,['moanRetract,y,MKQ t]]]
+ ['%otherwise,['moanRetract,y,quoteMode t]]]
symbolEq?(x,y) => expr
['%bind,[[y,x]],expr]