Numeric separator syntax: Difference between revisions

Content added Content deleted
(Added Go)
Line 148: Line 148:
=={{header|Racket}}==
=={{header|Racket}}==


Vanilla Racket does not have numeric separator syntax. However, it can be defined by users. For instance:
Vanilla Racket does not have numeric separator syntax. However, it can be defined by users. A quick solution is to use <code>#%top<code>:


<lang racket>#lang racket
<lang racket>#lang racket
Line 202: Line 202:
1_234__567.89: invalid multiple consecutive separators in: 1_234__567.89
1_234__567.89: invalid multiple consecutive separators in: 1_234__567.89
</pre>
</pre>

A more complicated solution is to create a new language that changes Racket's reader. One approach is to adjust the readtable to recognize the new number literals so that we don't need to change the whole reader. While being slightly more complicated, this solution is better in a sense that <code>(read)</code> will also recognize the new number literals.


=={{header|REXX}}==
=={{header|REXX}}==