Complexity Shock Horror II: the Sequel (was Re: MD5 in erlang
Tony Rogvall
tony@REDACTED
Mon Mar 31 15:33:50 CEST 2003
Raimo Niskanen wrote:
>
> Some comments and some problems. Since Erlang supports the Base#Integer
> syntax i think that Base in:
> integer_to_list(Integer, Base)
> should be 2..16, not atoms.
>
I just thought it would look nice, but I can buy 2..16 (btw do you know
any one using base 13 for output? and since we only alow 2..16 its kind
of crippled anyway)
> The same for:
> list_to_integer(List, Base)
>
Oh well.
> But what should happen if you call list_to_integer("16#1f", 8), and how
> should you specify any base. I guess the answers are: badarg on the
> first and list_to_integer("16#1f", undefined) on the second question.
>
Like you said, do NOT allow base syntax in the list_to_integer/2 (why
should you?) but maybe in list_to_integer/1 (if that does not break
anything, it could!)
> And to add the prefix in the Right(tm) way is a bit awkward:
> List = case integer_to_list(Integer, 16) of
> [$-|L] -> "-16#"++L;
> L -> "16#"++L
> end
My oppinon is that we ignore the prefix stuff completly just to get
things on it's way. I myself have never sent any output in base syntax
(anyone?).
/Tony
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20030331/da2d039d/attachment.bin>
More information about the erlang-questions
mailing list