Background: I'm trying to rewrite my previously posted implementation of
the Dirichlet ring, using

PositveInteger -> Coef

as representation.  (I think this is more what I want in comparison to
the representation Stream Coef)

However, I ran into a strange problem with "elt".  Namely, I do not
manage to add an operation

    elt: (%, PositiveInteger) -> Coef

to the domain - but any other seems to be OK!  Here is what happens:


(10) -> h(n: PI): INT  == n+1783
   Function declaration h : PositiveInteger -> Integer has been added 
      to workspace.
   Compiled code for h has been cleared.
   1 old definition(s) deleted for function or rule h 
                                                                   Type:  Void
(11) -> a := h::HI INT;
   Compiling function h with type PositiveInteger -> Integer 

                                                       Type: HiThere(Integer)

----------------------------------------------------------------------
1) without the signature elt: (%, PositiveInteger) -> Coef
----------------------------------------------------------------------

(12) -> chk(a, 1)

   (12)  1784
                                                        Type: PositiveInteger

----------------------------------------------------------------------
2) including the signature elt: (%, PositiveInteger) -> Coef (but
   without it's implementation)
----------------------------------------------------------------------

(15) -> chk(a, 1)
Function:  ?.? : (%,PositiveInteger) -> Integer is missing from domain: 
HiThere(Integer)
   Internal Error
   The function elt with signature (Integer)$(PositiveInteger) is missing 
      from domain HiThere(Integer) 

Note that chk shouldn't call elt$HiThere(Integer) at all!

----------------------------------------------------------------------
3) including the signature elt: (%, PositiveInteger) -> Coef and it's
   implementation
----------------------------------------------------------------------

(17) -> chk(a, 1)
 
   >> System error:
   invalid number of arguments: 2

----------------------------------------------------------------------


Help (in particular workarounds) greatly appreciated!

Martin


)abb package HI HiThere
HiThere(Coef: Ring): SetCategory with

        coerce: (PositiveInteger -> Coef) -> %
        chk: (%, PositiveInteger) -> Coef
-- commenting out the following makes it "work"
        elt: (%, PositiveInteger) -> Coef

    == add
        FUN ==> PositiveInteger -> Coef
        Rep := FUN

        per(a: Rep): % == a pretend %
        rep(a: %): Rep == a pretend Rep

        coerce(f: FUN): % == per f

        coerce(a: %): OutputForm == "hi"::OutputForm

        chk(a: %, n: PositiveInteger): Coef ==
            f: FUN := a pretend FUN
-- how can I simply "evaluate" f.  It seems that FriCAS tries to call
            elt...
            x: Coef := f n
            x

--        elt(a: %, n: PositiveInteger): Coef ==
--            f: FUN := a pretend FUN
--            x: Coef := f(n)
--            x

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to