Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Support Numeric Underscores #30

Open
brekk opened this issue Nov 25, 2020 · 0 comments
Open

Support Numeric Underscores #30

brekk opened this issue Nov 25, 2020 · 0 comments
Labels
📘 proposal An idea for a thing

Comments

@brekk
Copy link
Contributor

brekk commented Nov 25, 2020

based on this haskell language extension we might want to support underscores in numeric literals:

-- decimal
million    = 1_000_000
billion    = 1_000_000_000
lightspeed = 299_792_458
version    = 8_04_1
date       = 2017_12_31

-- hexadecimal
red_mask = 0xff_00_00
size1G   = 0x3fff_ffff

-- binary
bit8th   = 0b01_0000_0000
packbits = 0b1_11_01_0000_0_111
bigbits  = 0b1100_1011__1110_1111__0101_0011

-- float
pi       = 3.141_592_653_589_793
faraday  = 96_485.332_89
avogadro = 6.022_140_857e+23

-- function
isUnderMillion = (< 1_000_000)

clip64M x
    | x > 0x3ff_ffff = 0x3ff_ffff
    | otherwise = x

test8bit x = (0b01_0000_0000 .&. x) /= 0
@brekk brekk added the 📘 proposal An idea for a thing label Dec 9, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
📘 proposal An idea for a thing
Projects
None yet
Development

No branches or pull requests

1 participant