diff options
author | dos-reis <gdr@axiomatics.org> | 2009-01-03 10:26:16 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-01-03 10:26:16 +0000 |
commit | ad0d6445de436a1c7c04cfe14316d620cb9202b3 (patch) | |
tree | 2165a9a2446cc52a27bd6545359607e7dc376599 /src/interp/g-util.boot | |
parent | 844be40b5b876fffd816f285f87711cca6ef3121 (diff) | |
download | open-axiom-ad0d6445de436a1c7c04cfe14316d620cb9202b3.tar.gz |
2009-01-03 Gabriel Dos Reis <gdr@cs.tamu.edu>
* Makefile.pamphlet (AXIOM_SRC_TARGETS): Add all-databases.
src/ChangeLog
2009-01-03 Gabriel Dos Reis <gdr@cs.tamu.edu>
* lisp/core.lisp.in (|%algebraSystemIsComplete|): New.
(|%basicSystemIsComplete|): Use it.
* interp/wi1.boot (setqSingle): Use maximalSuperType.
(coerceSubset): Simplify.
(compCoerce1): Tidy.
* interp/i-resolv.boot (resolveTCat): Use superType.
* interp/lisplib.boot (findConstructorSlotNumber): Use isSubset.
(sigsMatch): Likewise.
(findDomainSlotNumber): Likewise.
* interp/define.boot (compSubDomain1): Reject for complex subdomain
predicate. Support paramterized subdomains.
* interp/daase.lisp (interpOpen): Read superdomain slot.
(getdatabase): Remove adhoc hardcoded superdomain info.
Return superdomain info stored in database.
(localnrlib): Read superdomain info.
(write-interpdb): Write superdomain info.
(database): Add superdomain slot.
* interp/g-util.boot (superType): New.
(maximalSuperType): Rework. Support parameterized subdomains.
(noteSubDomainInfo): New.
(isSubDomain): Rework.
* interp/c-util.boot (isSubset): Rework.
* interp/g-opt.boot (optEQ): Remove.
* interp/g-cndata.boot (getImmediateSuperDomain): Remove.
(maximalSuperType): Move to g-util.boot.
* interp/types.boot (%Constructor): New type specifier.
(%Instantiation): Likewise.
* interp/compiler.boot (primitiveType): Don't return $NegativeInteger.
(maxSuperType): Remove.
(hasType): Use maximalSuperType.
(satisfies): New.
(coerceSubset): Use it. Simplify.
* interp/wi2.boot (smallIntegerStep): Use maximalSuperType.
* interp/sys-constants.boot ($AtVariables): New.
($NegativeInteger): Remove.
($NonPositiveInteger): Likewise.
($CategoryNames): Category is not a category.
* interp/property.lisp: Remove Subsets property settings.
* interp/i-coerce.boot (coerceSubDomain): Simplify.
(coerceImmediateSubDomain): Remove.
(getSubDomainPredicate): Simplify.
* interp/category.boot (SourceLevelSubset): Use isSubDomain.
(MachineLevelSubset): Likewise.
* interp/modemap.boot (mergeModemap): Likewise.
(isSuperDomain): Remove.
(augModemapsFromDomain): Support parameterized subdomains.
* interp/i-util.boot (isSubDomain): Move to g-util.boot.
* Makefile.pamphlet (all-databases): New target.
* interp/Makefile.pamphlet ($(AXIOMSYS)): Push
:open-axiom-algebra-system onto *FEATURES*.
* etc/Makefile.in (all-databases): New target.
Diffstat (limited to 'src/interp/g-util.boot')
-rw-r--r-- | src/interp/g-util.boot | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 39302d6b..6f2961d8 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2008, Gabriel Dos Reis. +-- Copyright (C) 2007-2009, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ module g_-util where getTypeOfSyntax: %Form -> %Mode pairList: (%List,%List) -> %List mkList: %List -> %List + isSubDomain: (%Mode,%Mode) -> %Form ++ $interpOnly := false @@ -62,6 +63,62 @@ isSharpVarWithNum x == ok := DIGITP d => c := 10*c + DIG2FIX d if ok then c else nil + +--% Sub-domains information handlers + +++ If `dom' is a subdomain, return its immediate super-domain. +superType: %Mode -> %Maybe %Mode +superType dom == + dom isnt [ctor,:args] => nil + [super,.] := getSuperDomainFromDB ctor or return nil + sublisFormal(args,super,$AtVariables) + +++ Return the root of the reflexive transitive closure of +++ the super-domain chain for the domain designated by the domain +++ form `d'. +maximalSuperType: %Mode -> %Mode +maximalSuperType d == + atom d => d + d' := superType d => maximalSuperType d' + d + +++ Note that the functor `sub' instantiates to domains that +++ are subdomains of `super' instances restricted by the +++ predicate `pred'. +noteSubDomainInfo: (%Symbol,%Instantiation,%Form) -> %Thing +noteSubDomainInfo(sub,super,pred) == + MAKEPROP(sub,"%SuperDomain",[super,pred]) + +++ Returns non-nil if `d1' is a sub-domain of `d2'. This is the +++ case when `d1' is transitively given by an instance of SubDomain +++ d1 == SubDomain(d2,pred) +++ The transitive closure of the predicate form is returned, where +++ the predicate parameter is `#1'. +isSubDomain(d1,d2) == + atom d1 or atom d2 => false + + -- 1. Easy, if by syntax constructs. + d1 is ["SubDomain",=d2,pred] => pred + + -- 2. Just say no, if there is no hope. + [sup,pred] := getSuperDomainFromDB first d1 or return false + + -- 3. We may be onto something. + -- `sup' and `pred' are in most general form. Instantiate. + first sup = first d2 => + -- sanity check. `d2' should be an instance of `sup'. + sublisFormal(rest d1,sup,$AtVariables) ^= d2 => + stackAndThrow('"unexpected instantiation mismatch",nil) + sublisFormal(rest d1,pred,$AtVariables) + + -- 4. Otherwise, lookup in the super-domain chain. + pred' := isSubDomain(sup,d2) => MKPF([pred',pred],"AND") + + -- 5. Lot of smoke, no fire. + false + +--% + mkList u == u => ["LIST",:u] nil @@ -512,7 +569,7 @@ mergeInPlace(f,g,p,q) == r mergeSort(f,g,p,n) == - if EQ(n,2) and FUNCALL(f,FUNCALL(g,QCADR p),FUNCALL(g,QCAR p)) then + if n=2 and FUNCALL(f,FUNCALL(g,QCADR p),FUNCALL(g,QCAR p)) then t := p p := QCDR p QRPLACD(p,t) |