Underscores in numbers for legibility
Lassi Kortela 12 Apr 2019 18:54 UTC
Has there been any discussion of standardizing the use of underscores in
the read/write syntax of numbers?
Gauche lets me write this:
gosh> #d123_456
123456
gosh> (format "~x" #x123_4_56)
"123456"
However, without a base prefix (i.e. #b #o #d #x) a number is
interpreted as a symbol:
123_456
The Ruby language also allows underscores in numbers. Common Lisp leaves
a provision for it in the standard but I don't know of any
implementations that use the opportunity.
I find that it makes it a lot easier to read long strings of digits if
you can separate them into groups like that. YMMV.