<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">> <span class="Apple-style-span" style="line-height: 16px; ">There is bug in your code I think. <br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">> Correct code should be: <br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">> decode(<<L:8/unsigned, R/binary>>) -> <br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">> Len = (L - 16#20)*8, <br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">> <<Rest:Len/unsigned, _/binary>> = R, <br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">> Rest. </span><div><span class="Apple-style-span" style="line-height: 16px; "><br class="webkit-block-placeholder"></span></div><div><span class="Apple-style-span" style="line-height: 16px; ">That's how I ended solving it, but there was also a bug in the way I specified the problem, what I was attempting to ask was whether something this was possible:</span></div><div><br></div><div><font class="Apple-style-span" face="'Trebuchet MS'" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">decode</span></font></font><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">(<<</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">L</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">:</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">8</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">,</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">Bin</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">:(</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">L</span></font></font></span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"> </span></font></font><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">-</span></font></font></span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"> </span></font></font><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">16#20</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">)/</span></font></font></span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">binary</span></font></font><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">,</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">Rest</span></font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">/</span></font></font></span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">binary</span></font></font><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">>>)</span></font></font></span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"> </span></font></font><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">-> <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3">Bin</font></font></span><span style=""><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3">.</font></font></span></span></span></font></font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br class="webkit-block-placeholder"></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">So <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3">decode</font></font><span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3">(<<16#23</font></font></span><span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3">,</font></font></span><span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3">"abcdefg"</font></font></span><span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3">>>) would return <<"abc">>.</font></font></span></span></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br class="webkit-block-placeholder"></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Helvetica" size="3">Essentially this is the same thing as your solution, only expressed in a more compact format. However, it doesn't appear to be a legal operation in Erlang bit syntax. </font></font></span></span></span></font></div></span></font></div></body></html>