bit syntax documentation
Bjorn Gustavsson
bjorn@REDACTED
Tue Apr 3 17:26:35 CEST 2001
Thanks for pointing out the error.
The head should have been
foo(<<X:7/binary-unit:1,Y:1/binary-unit:1>>) ->
We will correct the documentation in the R8 release.
/Bjorn
Ulf Wiger <etxuwig@REDACTED> writes:
> 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
>
--
Björn Gustavsson Ericsson Utvecklings AB
bjorn@REDACTED ÄT2/UAB/F/P
BOX 1505
+46 8 727 56 87 125 25 Älvsjö
More information about the erlang-questions
mailing list