someone wrote:
> 
> Next I have this code for creating new vector objects:
> 
>     vector(x:Symbol) : % == [ [1::R, [], [string x]] ]::%
> 
> Is this ok? It seems to work but I don't know if this is the
> best way to do it.

AFAICS more explicit way of writing this would be:

      vector(x:Symbol) : % == [ [1::R, [], [string x]] ]$Rep

or maybe:

      vector(x:Symbol) : % == [ [1::R, [], [string x]] ]$Rep::%

(Spad compiler performs the last coercion automatically, as long
as you define 'Rep := ....')

BTW: I see that you wrote:

    normalForm(xx:Rep) : Rep ==
        ......

    -- Issue: makes "something" looping
    --normalForm(x:%) : % ==
    --  normalForm(x::Rep)::%

Trying to overload on '%' and 'Rep' is asking for trouble because
Spad compiler automaticaly converts between them and your
second function probably was compiled to infinite recursion.
Normally I would write:

    normalForm(x : %) : % ==
        xx : Rep := x
        ....

In other words I would use '%' even for internal functions and
convert from/to Rep as needed.

BTW: Ralf advice disables automatic convertion between '%' and
'Rep' but otherwise has similar effect (the difference beeing
that in the style here one puts types on variables while he
prefers 'rep' and 'per').

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