
25 Oct
2007
25 Oct
'07
6:42 a.m.
Don Stewart
Are there binary constants in Haskell, as we have, for instance, 0o232 for octal and 0xD29A for hexadecimal?
No, though it is an interesting idea.
Presumably it is less common since octal and hexadecimal are more compact and almost as easy to interpret as bit patterns? Why would you want them? Prelude> let bin = foldl... Prelude> 0o232 154 Prelude> bin [0,1,0, 0,1,1, 0,1,0] 154 Prelude> 0xD29A 53914 Prelude> bin [1,1,0,1, 0,0,1,0, 1,0,0,1, 1,0,1,0] 53914 -k -- If I haven't seen further, it is by standing in the footprints of giants