3 ms·
some errors there. head = 0x00 piece = <<0x01, 0x01, 0x01, 0x01, 0x01>> << head, # When a variable is already referenced it must be equal for
by codesnik 4y ago
some errors there.
head = 0x00
piece = <<0x01, 0x01, 0x01, 0x01, 0x01>>
<< head, # When a variable is already referenced it must be equal for the pattern to match
piece, # Match a string
rest :: binary >> # You can mix matching variables and assigning new variables.
it should have ^head, and ^piece (the term is "pinning"). Unlike in erlang, elixir will happily "reassign" variables to the new content on whatever is on a right side of the match.