aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-11-14 04:55:20 +0000
committerdos-reis <gdr@axiomatics.org>2011-11-14 04:55:20 +0000
commit12a65643579cab809e4a7c95f6ebc9124da4bf3f (patch)
treecb4ecaeb7b7d6b16679abf35242166c8da68d372
parent5f63d42cf83ebce312a44c5d596e85c6ae879ab0 (diff)
downloadopen-axiom-12a65643579cab809e4a7c95f6ebc9124da4bf3f.tar.gz
* interp/category.boot (filterConditionalCategories): Split out of
JoinInner. (JoinInner): Call it.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/interp/category.boot55
2 files changed, 40 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 89355641..b02f7608 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
2011-11-13 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/category.boot (filterConditionalCategories): Split out of
+ JoinInner.
+ (JoinInner): Call it.
+
+2011-11-13 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/category.boot (SigListMember): Remove as deadcode.
(SigEqual): Remove.
(predicateImplies): Rename from PredImplies. Rework it to match
diff --git a/src/interp/category.boot b/src/interp/category.boot
index 043b6d67..78661e10 100644
--- a/src/interp/category.boot
+++ b/src/interp/category.boot
@@ -359,30 +359,43 @@ DescendantP(a,b,e) ==
false
--% The implementation of Join
-
-JoinInner(l,$e) ==
- $NewCatVec: local := nil
- CondList:= nil
- for u in l repeat
- for [at,pred] in categoryAttributes u repeat
+
+++ We have a list `l' of category objects to be joined.
+++ Some of them may harbor other categories that exist only under
+++ certain conditions. Collect all those that are indisputably conditional
+++ and attempt to detect those apparent conditional categories whose
+++ predicates are satified in the current elaboration environment.
+++ The end result is a 2-list, the first component being a list of
+++ (catobj,pred) pairs and the second component being the list of
+++ newly discovered unconditional categories.
+filterConditionalCategories(l,e) ==
+ conditionals := nil
+ unconditionals := nil
+ for cat in l repeat
+ for [at,pred] in categoryAttributes cat repeat
if at isnt [.,:.] then at := [at]
- -- the variable $Attributes is built globally, so that true
- -- attributes can be detected without calling isCategoryForm
+ -- the variable $Attributes is built globally, so that true
+ -- attributes can be detected without calling isCategoryForm
symbolMember?(first at,$Attributes) => nil
- not isCategoryForm(at,$e) => $Attributes:=[first at,:$Attributes]
- listMember?(pred,get("$Information","special",$e)) =>
- l := [:l,CatEval(at,$e)]
- --It's true, so we add this as unconditional
+ not isCategoryForm(at,e) => $Attributes := [first at,:$Attributes]
+ listMember?(pred,get("$Information","special",e)) =>
+ --It's true, so we add it as unconditional
+ unconditionals := [CatEval(at,e),:unconditionals]
pred isnt ["and",:.] =>
- CondList := [[CatEval(at,$e),pred],:CondList]
- pred' := [u for u in pred.args |
- not listMember?(u,get("$Information","special",$e))
- and u isnt true]
- pred' = nil => l := [:l,CatEval(at,$e)]
- pred' is [.] => CondList := [[CatEval(at,$e),pred'],:CondList]
- CondList := [[CatEval(at,$e),["and",:pred']],:CondList]
- [$NewCatVec,:l]:= l
- l':= [:CondList,:[[u,true] for u in l]]
+ conditionals := [[CatEval(at,e),pred],:conditionals]
+ pred' := [x for x in pred.args |
+ not listMember?(x,get("$Information","special",e))
+ and x isnt true]
+ pred' = nil => unconditionals := [CatEval(at,e),:unconditionals]
+ pred' is [.] => conditionals := [[CatEval(at,e),pred'],:conditionals]
+ conditionals := [[CatEval(at,e),["and",:pred']],:conditionals]
+ [conditionals,reverse! unconditionals]
+
+JoinInner(l,$e) ==
+ $NewCatVec: local := nil
+ [CondList,uncondList] := filterConditionalCategories(l,$e)
+ [$NewCatVec,:l] := [:l,:uncondList]
+ l' := [:CondList,:[[u,true] for u in l]]
-- This is a list of all the categories that this extends
-- conditionally or unconditionally
sigl := categoryExports $NewCatVec