[erlang-questions] bit operations/matching

Alexander Wagner waqner@REDACTED
Thu May 8 19:40:05 CEST 2008


> Can someone explain why line 2 fails (and line 3 not)?

The binary() type consist of full bytes, so your binary tail has to be a 
multiple of 8 bits long.

This works (although there might be a more elegant way):
<<_:80,Val:2,_:6,_/binary>> = B.

Regards,
  Wag

-- 
If you pay peanuts expect monkeys to do the work.



More information about the erlang-questions mailing list