This is not ISO Prolog, but quite useful.
Compare with Java where this trick is allowed for any numeric constants ("numeric literals" in parsespeak).
https://docs.oracle.com/javase/8/docs/technotes/guides/language/underscores-literals.html
Did you know ... | Search Documentation: |
Using digit groups in large integers |
SWI-Prolog supports splitting long integers into digit groups. Digit groups can be separated with the sequence <underscore>, <optional white space>. If the <radix> is 10 or lower, they may also be separated with exactly one space. The following all express the integer 1 million:
1_000_000 1 000 000 1_000_/*more*/000
Integers can be printed using this notation with format/2,
using the
~I
format specifier. For example:
?- format('~I', [1000000]). 1_000_000
The current syntax has been proposed by Ulrich Neumerkel on the SWI-Prolog mailinglist.
This is not ISO Prolog, but quite useful.
Compare with Java where this trick is allowed for any numeric constants ("numeric literals" in parsespeak).
https://docs.oracle.com/javase/8/docs/technotes/guides/language/underscores-literals.html