[erlang-questions] unexpected result of term_to_binary

Paul Davis paul.joseph.davis@REDACTED
Mon Jan 21 20:46:33 CET 2013


In Erlang a list of integers in the range 0-255 is a string. An easy test
is to show that the value 256 changes the encoding into a list of integers:

> term_to_binary([1, 2, 3, 4, 256]).
<<131,108,0,0,0,5,97,1,97,2,97,3,97,4,98,0,0,1,0,106>>



On Mon, Jan 21, 2013 at 1:38 PM, Steve Davis <steven.charles.davis@REDACTED
> wrote:

> The following appears to encode lists of integers as strings (?!?):
>
> Eshell V5.9.3  (abort with ^G)
> 1> term_to_binary([1,2,3,4]).
> <<131,107,0,4,1,2,3,4>>
>
> Is there a reason for this that I'm missing?
>
> regs,
> /s
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130121/021c0deb/attachment.htm>


More information about the erlang-questions mailing list