Re: Printing numbers with underscores
Lassi Kortela 19 Apr 2019 21:33 UTC
> Yes. The `numeric` formatter in 159 and 166 is exactly the same, except
> that 166 supports insertion after a variable number of digits and 159
> doesn't.
What about exotic stuff having underscores in the denominator of a
rational number or in the exponent or fractional part of a real number?
Maybe 166 already handles those, or perhaps they are not that important
when printing.
> In light of 159 and 166 existing, would you recommend specifying
> anything at all about printing in this new 169?
>
> I would recommend pointing out that SRFI 166 can insert the
> underscores and leave it at that.
What about printing underscores in the REPL though? I thought that would
be the main thing that's useful. A typical example would be using the
Scheme REPL as a fancy calculator. It's not as critical (and can often
be unwanted) to have underscores when printing S-expressions to files.
We could leave it up to each implementation to optionally have a
variable or parameter that turns underscore printing on in the REPL, but
then that parameter could end up having a different name in all
implementations.
Another option is if the implementation can check whether an output port
is an interactive one, and always print underscores in that case. On
Unix, isatty(stdout) might be a good enough check.
<http://pubs.opengroup.org/onlinepubs/000095399/functions/isatty.html>