aboutsummaryrefslogtreecommitdiff
path: root/src/interp/define.boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp/define.boot')
-rw-r--r--src/interp/define.boot20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/interp/define.boot b/src/interp/define.boot
index 2b9470f2..1303e141 100644
--- a/src/interp/define.boot
+++ b/src/interp/define.boot
@@ -630,6 +630,26 @@ expandTypeArgs(u,template,domform) ==
u isnt [.,:.] => u
expandType(u,template,domform)
+explodeIfs x == main where --called by getParents, getParentsForDomain
+ main() ==
+ x is ['IF,p,a,b] => fn(p,a,b)
+ [[x,:true]]
+ fn(p,a,b) ==
+ [:"append"/[gn(p,y) for y in a],:"append"/[gn(['NOT,p],y) for y in b]]
+ gn(p,a) ==
+ a is ['IF,q,b,:.] => fn(MKPF([p,q],'AND),b,nil)
+ [[a,:p]]
+
+getParentsFor(db,formalParams) ==
+ acc := nil
+ formals := take(#formalParams,$TriangleVariableList)
+ constructorForm := dbConstructorForm db
+ for x in folks dbCategory db repeat
+ x := applySubst(pairList(formals,formalParams),x)
+ x := applySubst(pairList(formalParams,constructorForm.args),x)
+ acc := [:explodeIfs x,:acc]
+ reverse! acc
+
--% Subdomains
++ We are defining a functor with head given by `form', as a subdomain