Cool, thank you for the hints!

I'll check whether special casing atoms makes sense.  Should I prepare a 
pull request or a simple patch, and should I add testcases to a new file or 
to an existing file.

Finally, do you prefer the current InputForm for sum and product (%defsum, 
%defprod), which "interpret" does not handle, or should I prepare a patch 
for this one, too?

Best wishese,

Martin

Am Mittwoch, 18. Juli 2018 00:58:58 UTC+2 schrieb Waldek Hebisch:
>
> Martin R wrote: 
> > 
> > I am sorry it took so long.  Attached there is a patch which appears to 
> > work well: 
> > 
> > (1) -> (3^2)$OUTFORM 
> > 
> >          2 
> >    (1)  3 
> >                                                              Type: 
> > OutputForm 
> > (2) -> (3^2)$OUTFORM::INFORM 
> > 
> >    (2)  '(^ 3 2) 
> >                                                               Type: 
> > InputForm 
> > (3) -> interpret((3^2)$OUTFORM::INFORM) 
> > 
> >          2 
> >    (3)  3 
> >                                                              Type: 
> > OutputForm 
>
> That is OK.  But AFAICS with your code we depend on quote giving 
> us the right type.  But it seems that this is not always so: 
>
> (11) -> interpret((1::OUTFORM)::INFORM) 
>
>    (11)  1 
>                                                         Type: 
> PositiveInteger 
> (16) -> atType((1::OUTFORM)::INFORM)$InputFormFunctions1(OUTFORM) 
>
>    (16)  (@ '1 (OutputForm)) 
>                                                               Type: 
> InputForm 
> (17) -> 
> interpret(atType((1::OUTFORM)::INFORM)$InputFormFunctions1(OUTFORM)) 
>   
>    An expression involving @ OutputForm actually evaluated to one of 
>       type PositiveInteger . Perhaps you should use :: OutputForm . 
>
> Worse, for strings we get wrong value: 
>
> (22) -> interpret(("x"::OUTFORM)::INFORM) 
>
>    (22)  ""x"" 
>                                                                  Type: 
> String 
>
> This is because coercion from strings to OutputForm adds quotes. 
>
> So minimally, one must special case coercion of OutputForm 
> consisting from single string. 
>
> -- 
>                               Waldek Hebisch 
>

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to