login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

In a domain and in categories referenced in a domain the notation % represents "this domain" (or self in some programming languages). So we commonly write for example:

  with
    f: (%,%) -> %

to indicate a function f which takes a pair of values in this domain and returns a value in this same domain - whatever domain we happen to be talking about in this context.

But what if we are interested in the domain as a functor? Suppose I was writing an "endofunctor" domain constructor like Set and I wanted to treat constructions like Set Set R, i.e. sets of sets as something special. E.g.

fricas
(1) -> <aldor>
--)abbrev domain MYSET MySet
#pile
#include "axiom"
MonadCat(T:SetCategory,M:SetCategory->SetCategory):Category == with
  join: M M T -> M T
MySet(T:SetCategory): Join(MonadCat(T,MySet),SetAggregate(T)) with finiteAggregate --join: MySet MySet T -> MySet T == add Rep == List T --rep(x:%):Rep == x pretend Rep --per(x:Rep):% == x pretend %
Rep2 == List List T rep2(x:MySet MySet T):Rep2 == x pretend Rep2 per2(x:Rep2):MySet MySet T == x pretend MySet MySet T
coerce(x:%):OutputForm == brace(map(coerce$T, rep x)$ListFunctions2(T,OutputForm)) ((x:%) = (y:%)):Boolean == (rep(x) = rep(y))$Rep construct(x:List T):% == per(removeDuplicates(x)$Rep) parts(x:%):List T == rep x join(x:MySet MySet T):MySet T == construct(concat(rep2 x)$List(T))$%
copy(x:%):% == per(copy(rep x)$Rep) empty():% == per(empty()$Rep) map(f:T->T,x:%):% == per(map(f,rep x)$Rep) brace():% == empty()$% brace(x:List(T)):% == construct(x)$% set():% == empty()$% set(x:List(T)):% == construct(x)$%
-- dummy exports as required by Aldor _<(x:%, y:%):Boolean == true intersect(x:%, y:%):% == empty()$% difference(x:%, y:%):% == empty()$% subset?(x:%, y:%):Boolean == true union(x:%, y:%):% == empty()$% if T has ConvertibleTo(InputForm) then convert(x:%):InputForm == convert(rep(x))$Rep</aldor>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8835079522190382419-25px001.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8835079522190382419-25px001.as", line 3: 
#include "axiom"
^
[L3 C1] #1 (Error) Could not open file `axiom'.
The )library system command was not called after compilation.

fricas
)sh MySet
The )show system command is used to display information about types or partial types. For example, )show Integer will show information about Integer .
MySet is not the name of a known type constructor. If you want to see information about any operations named MySet , issue )display operations MySet
fricas
)di op join
There are 6 unexposed functions called join : [1] (D,NonNegativeInteger,NonNegativeInteger) -> NonNegativeInteger from D if D has DCPO(D2) and D2 has SETCAT [2] (JetDifferentialEquation(D1,D2),JetDifferentialEquation(D1,D2)) -> JetDifferentialEquation(D1,D2) from JetDifferentialEquation(D1,D2) if D1 has JBC and D2 has JBFC(D1) [3] List(LatticeJoinOfMeets) -> LatticeJoinOfMeets from LatticeJoinOfMeets [4] List(LatticeMeetOfJoins) -> LatticeMeetOfJoins from LatticeMeetOfJoins [5] (OrientedFacet,OrientedFacet) -> OrientedFacet from OrientedFacet [6] (SparseEchelonMatrix(D1,D2),SparseEchelonMatrix(D1,D2)) -> SparseEchelonMatrix(D1,D2) from SparseEchelonMatrix(D1,D2) if D1 has ORDSET and D2 has RING

fricas
MySet(Integer) has MonadCat(Integer,MySet)
There are no library operations named MySet Use HyperDoc Browse or issue )what op MySet to learn if there is any operation containing " MySet " in its name.
Cannot find a definition or applicable library operation named MySet with argument type(s) Type
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

fricas
m1:MySet(Integer) := construct([1,2,3])$MySet(Integer)
There are no library operations named MySet Use HyperDoc Browse or issue )what op MySet to learn if there is any operation containing " MySet " in its name.
Cannot find a definition or applicable library operation named MySet with argument type(s) Type
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: