Martin Rubey wrote:
> Martin Rubey <[email protected]> writes:
> 
> > Rep := PositiveInteger -> Coef
> >
> > which is however caching values.  Or maybe I should just forget about
> > the caching?
> 
> 
> As a follow up - is the following sensible?  (it does work)
> 
> The only thing that would be affected is the way the user coerces
> functions into the DirichletRing.  Actually, I think I like it...
> 
> (4) -> g: PI -> INT := n +-> n
> 
> (4) -> g 1
> 
>    (4)  1
> 
> (5) -> g::HI(INT)
> 
>    (5)  1
>                                                        Type: HiThere(Integer)
> (7) -> h(n: PI): INT  == n+1783
>    Function declaration h : PositiveInteger -> Integer has been added
>       to workspace.
>    1 old definition(s) deleted for function or rule h
>                                                        Type: Void
> (8) -> h::HI(INT)
>    Compiling function h with type PositiveInteger -> Integer
> 
>    (8)  1784
>                                                        Type: HiThere(Integer)
> 
> 
> )abb package HI HiThere
> HiThere(Coef: SetCategory): SetCategory with
>         coerce: (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 == 
>             f: FUN := a pretend FUN
>             x: Coef := f(1$PositiveInteger)
>             x::OutputForm
> 


Remarks:
- I am not sure what you gain compared to Mapping
- Coercion to OutputForm looks fishy.
- you need some way to evaluate the functions (using
  'pretend' every time you wnat to evaluate is ugly)
- without caching you will be recomputing values multiple
  times which may be as bad (or worse) as comuting all
  values once.

-- 
                              Waldek Hebisch
[email protected] 

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