Hello,

Le sam. 13 avr. 2024 à 21:05, Waldek Hebisch <de...@fricas.org> a écrit :
>
> On Sun, Apr 07, 2024 at 06:05:39AM +0200, Grégory Vanuxem wrote:
> >
> > It is possible to modify some parameters to Float output routines,
> > what about returning the previous settings? For example
> > outputSpacing(n) returns Void but if you want to temporarily modify
> > this setting, in Spad for example, reverting to the user setting is
> > not possible. I attached a proof of concept patch that implements
> > this. In fact, even the macro 'separator ==> underscore()$Character'
> > could also be parametrable, it is not in this diff though.
>
> Thinking more about this: it should be possible to restore _whole_
> previous settings.  So probably we need something like:
>
>     get_output_mode : () -> Record(mode : String, prec : String)
>
> othewise, after
>
>     outputFixed()
>     n := outputGeneral(12)
>
> we have no clue that previous mode was "fixed".

Yes, exactly.

> Also, '-1' is
> valid as precision, but to set arbitrary valid precision one
> would have to use code like
>
>     if prec = -1 then
>         outputFixed()
>     else
>         outputFixed(prec::NonNegativeInteger)

Yes, and as -1 is not documented and only "settable" via output*
without arguments I guess you are thinking about an Integer argument
to set the precision, am I right?

> And to set desired mode we would need chain of tests.  So it seems
> that we need funtion
>
>    set_output_mode : (Stiring, Integer) -> Record(mode : String, prec : 
> String)

So a general routine, just some checks to do. I agree that it could be
handy, and, even, an error message can be displayed, in case of a typo
for example, that helps the user in the interpreter for the different
mode available (no full explanation of course). It just remains from
my point of view the previous spacing setting as suggested in the
previous diff.

> which sets desired mode.  I wrote above version that returns old settings,
> but in principle version that returns Void is enough given 'get_output_mode'.

Agreed.

- Greg

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/CAHnU2dYbamy_HxWN1y2OsExbkLV3Gz2gCogBsbtffL411zn8Cg%40mail.gmail.com.

Reply via email to