bit syntax documentation

Ulf Wiger etxuwig@REDACTED
Tue Apr 3 17:18:32 CEST 2001


In the documentation for the bit syntax, I read the following:


"A segment of type binary must have a size evenly divisible by 8. 

     This means that the following head will never match: 

     foo(<<X:7/binary,Y:1/binary>>) ->"

(http://www.erlang.org/doc/r7b/doc/extensions/bit_syntax.html#6.6)

Since my code didn't work as expected, I tried to verify this:



30> F = fun(<<X:7/binary,Y:1/binary>>) -> {X,Y}; (Other) -> Other
end.
#Fun<erl_eval.17.63972567>
31> F(<<"12345678">>).                                                     
{<<49,50,51,52,53,54,55>>,<<56>>}



In other words, the head described in the manual matches just fine.

Comments?

/Uffe
-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB




More information about the erlang-questions mailing list