On Thu, Sep 18, 2008 at 1:03 PM, Waldek Hebisch wrote:
>
> Bill Page wrote:
>> ...
>> Although we could generate "float(1,0,2)$Float" in this case we do
>> not need to generate the package call because the signature of
>> 'float$Float' is deliberately chosen to be unambiguous in the
>> interpreter (parse). I believe this is typical of the design of most
>> domains.
>>
>
> What you wrote works for "simple" domains. But many domains
> have parameters. For example, given:
>
> (x^3+1)::Polynomial PF(5)
>
> you need some way to get the prime 5 into InputForm.
>
Even in this case there is a way to express this without package calls
by just coercing the generators:
(1) -> convert([_+::InputForm, _
convert([_*_*::InputForm, _
convert(["::"::Symbol::InputForm, _
convert(["::"::Symbol::InputForm,x::InputForm,"Symbol"::Symbol::InputForm]),
_
convert(["Polynomial"::Symbol::InputForm, _
convert(["PrimeField"::Symbol::InputForm,5::InputForm]) _
]) _
]),3::InputForm _
]), _
1::InputForm _
])
(1) (+ (** (:: (:: x Symbol) (Polynomial (PrimeField 5))) 3) 1)
Type: InputForm
(2) -> interpret(%)
3
(2) x + 1
Type: Polynomial(PrimeField(5))
But you might be right in this case that a package call is more "natural".
Right now we have a different problem:
(3) -> (x^3+1)::Polynomial PF(5)
3
(3) x + 1
Type: Polynomial(PrimeField(5))
(4) -> %::InputForm
Cannot convert from type Polynomial(PrimeField(5)) to InputForm for
value
3
x + 1
This sort of coercion is not implemented yet.
> ...
> Again test for infinite recursion fired when it should not.
> You may remove line with BREAK from appOrParen, or better
> change begining of binop2String and appOrParen to be as
> below (only the 2 lines which contained '$curOp' has
> changed).
> ...
Great! This works now.
Regards,
Bill Page.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---