[erlang-questions] bit operations/matching

Igor Ribeiro Sucupira igorrs@REDACTED
Thu May 8 19:26:03 CEST 2008


Because (1000 - 80 - 2) is not a multiple of 8.  :-)

2008/5/8 Pieter Erlang <pietererlang@REDACTED>:
> Hi,
>
> Can someone explain why line 2 fails (and line 3 not)?
> (also reproducible in other ways)
>
> Thx
> Pieter
> PS. unfortunately and only temporarily running on windows xp
>
>
> Erlang (BEAM) emulator version 5.6.2 [async-threads:0]
>
> Eshell V5.6.2 (abort with ^G)
> 1> B = <<0:1000>>.
> <<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
> 0,...>>
> 2> <<_:80,Val:2,_/binary>> = B.
> ** exception error: no match of right hand side value
> <<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
> 0,...>>
> 3> <<_:80,Val:8,_/binary>> = B.
> <<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
> 0,...>>
> 4>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list