|
|
|
last edited 13 years ago by Bill Page |
| 1 2 | ||
|
Editor: Bill Page
Time: 2011/12/02 07:51:07 GMT-8 |
||
| Note: MySet MySet | ||
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.
(1) -> <spad>
)abbrev domain MYSET MySet
MySet(T:SetCategory): 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 [i::OutputForm for i in rep x]
x = y == rep(x) = rep(y)
construct(x) == per removeDuplicates(x)$Rep
parts(x:%):List T == rep x
join x == construct concat rep2 x</spad>
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7834450198179479618-25px001.spad
using old system compiler.
MYSET abbreviates domain MySet
------------------------------------------------------------------------
initializing NRLIB MYSET for MySet
compiling into NRLIB MYSET
************* USER ERROR **********
available signatures for Rep:
NONE
NEED Rep: () -> ?
****** comp fails at level 1 with expression: ******
((DEF (|Rep|) (NIL) (|List| T$)))
****** level 1 ******
x:= (DEF (Rep) (NIL) (List T$))
m:= $EmptyMode
f:=
((((~= #) (= #) (|coerce| #) (|latex| #) ...)))
>> Apparent user error:
unspecified errorm1:MySet(Integer) := construct([1,2, 3])$MySet(Integer)
MySet is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead?