> 
> Does someone know why 'elt' in MyFun doesn't work as expected?
> 

Your 'elt' essentially is:

    elt(x: %, s: S): S == (x pretend S -> S)(s)

This is not going to work: pretend tries to compile x to get
result mode 'S -> S'.  This uses 'compWithMappingMode' which
provides a dummy argument and tries to compile 'x' applied
to the dummy, in other words we try to compile something like:

    x(%A)

That triggers 'elt' magic.  Something goes wrong and we get
a nonsense.  But if things worked correctly we would get
a closure containing recursive call to 'elt'.

AFAICS the following works as intended:

    coerce(x: %): S -> S == x pretend None pretend Rep
    elt(x: %, s: S): S == (x pretend None pretend Rep)(s)

Main point here is that None does not have 'elt' so 'pretend'
from 'None' works without any magic.

BTW: For this domain you probably should define 'rep' as:

rep(x) ==> x pretend None pretend Rep

because _any_ use of your version of 'rep' will lead to
call to 'elt'.

-- 
                              Waldek Hebisch
[email protected] 

-- 
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.

Reply via email to