Hello all,
// PLS, no flame
I think the question was not whether there's a way, how to handle the
problem of encryption of a binary number to anything suitable and, more
or less, readable by a human and transforming it to a binary form, but
whether there's such a literal or not and whether it is bad idea to have
something like 0b10111011.
From my point of view, the difference between 0b10111011 and
(bin[1,0,1,1,1,0,1,1]) is 22-10 that is 12 characters. Moreover,
allowing ADA features for all numeric literals we could have 0b1011_1011
;-) where the type would be Num a => a, of course.
So, i would expect only two answers: NO, it is ......., or YES, in
version 6.9.0 it is possible. ;-)
Dusan
Ketil Malde wrote:
Don Stewart <[EMAIL PROTECTED]> writes:
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
--
Dusan Kolar tel: +420 54 114 1238
UIFS FIT VUT Brno fax: +420 54 114 1270
Bozetechova 2 e-mail: [EMAIL PROTECTED]
Brno 612 66
Czech Republic
--
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe