title: How does binary-size work in Elixir
body: <p>I am currently trying to understand how <code>binary-size(number)</code> works in Elixir.
  In the example from <strong>The Little Elixir &amp; OTP Guidebook</strong> there is a section where they break apart a 128 byte ID3 tag. The tag has the following properties: </p>
  
  <ul>
  <li>3 byte header </li>
  <li>30 byte title tag</li>
  <li>30 byte artist tag</li>
  <li>30 byte album tag</li>
  <li>4 byte year tag</li>
  <li>Rest is packing</li>
  </ul>
  
  <p>The way in which they extract this in the book is </p>
  
  <pre><code>&lt;&lt; "TAG", title :: binary-size(30), artist :: binary-size(30), album :: binary-size(30), year:: binary-size(4), _ :: binary &gt;&gt;
  </code></pre>
  
  <p>I am having trouble understanding how each value gets the correct value from <code>binary-size(#num)</code>. Maybe it is the order in which the pattern matching is taking place and I am having trouble understand that. Currently I am approaching it as we first pattern match the header which is three bytes since it is hardcoded as <code>"TAG"</code>, at this point I'm not sure how we can get the value of 30 bytes from <code>binary-size(30)</code>. Is this operation being split up into two separate parts? Are we saying that first from 128, total byte size, we subtract 30 and then assign the value of size(30) to the title, and then carry this updated size to each value in the binary pattern match propagating any changes along the way?  </p>