rlwhitcomb / utilities

Some of my personal utility programs
MIT License
2 stars 0 forks source link

Consider never using separators for "@@" operator #636

Closed rlwhitcomb closed 7 months ago

rlwhitcomb commented 7 months ago

There are a lot of places in the Project Euler solutions where we have code similar to this:

$sep off { const STRING = @@NUM }

Seems kinda stupid for a conversion operator to be subject to a "display" setting, like "separators".

Also, "cast" to string will use the separator setting in effect, so if this is the desired result there is a way to do it instead of relying on "@@".

rlwhitcomb commented 7 months ago

Also doing interpolation you will also get the separators if enabled, as in:

c = pi * 10e20 -> 314,159,265,358,979,323,846,264.3383279503
`$c` -> "314,159,265,358,979,323,846,264.3383279503"
@@c -> "314159265358979323846264.3383279503"