digit groups

Iavor Diatchki iavor.diatchki at gmail.com
Wed Oct 25 20:51:00 EDT 2006


Hello,
while people are discussing different notations for literals, I
thought I should mention that in my work I have found it useful to
write literals ending in K (kilo), M (mega) or G (giga) for large
numbers.  For example, I can write 4K for (4 * 2^10), or 8M for (8 *
2^20) or 2G for (2 * 2^30).  It is simple to implement because it only
requires a modification to the lexer.  It is not really necessary
because we can achieve the same by defining:
kb,mg,gb :: Num a => a
kb = 1024
mb = 1024 * kb
gb = 1024 * mb
and now we can write (4 * kb) instead for 4096.  I still think that
the literal notation
is nicer though.
-Iavor



On 10/25/06, John Meacham <john at repetae.net> wrote:
> just for fun, I have implemented this for jhc.
> you can now write numbers like 10_000_000 if you choose.
>
> I have not decided whether I like the feature or not. but what the heck.
>
>         John
>
>
> --
> John Meacham - ⑆repetae.net⑆john⑈
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-prime
>


More information about the Haskell-prime mailing list