On 02/14/2014 12:11 PM, Ralf Hemmecke wrote:
> Does someone know why 'elt' in MyFun doesn't work as expected?
Oh... :-( Not so funny. The compiler seems to get confused over the
'elt' definition.
It works as seen below if there is no local implementation of an 'elt'
function. However, removing -- in front of elt (see attached code) leads
to the error that I reported in my previous mail.
How can this be fixed?
Ralf
(1) -> I ==> Integer
Type:
Void
(2) -> inc(i: I): I == i+1
Function declaration inc : Integer -> Integer has been added to
workspace.
Type:
Void
(3) -> minc := inc::MyFun(I);
Compiling function inc with type Integer -> Integer
Type:
MyFun(Integer)
(4) -> (minc pretend (I->I))(1)
(4) 2
Type:
PositiveInteger
(5) -> xelt(minc, 1)
(5) 2
Type:
PositiveInteger
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/groups/opt_out.
)abbrev category MYMON MyMonoid
MyMonoid: Category == with
1: %
_*: (%, %) -> %
rep x ==> (x@%) pretend Rep
per x ==> (x@Rep) pretend %
)abbrev domain MYFUN MyFun
MyFun(S: SetCategory): MyMonoid with
coerce: (S -> S) -> %
coerce: % -> (S -> S)
xelt: (%, S) -> S
== add
Rep ==> S -> S
coerce(f: S -> S): % == per f
coerce(x: %): S -> S == rep x
--elt(x: %, s: S): S == (rep x) s
xelt(x: %, s: S): S == (x pretend (S->S)) s
1: % == per((s: S): S +-> s)
((x: %) * (y: %)): % == per( (s: S): S +-> (rep x)(rep y) s )