<div dir="ltr">This is another exercise in Programming Edition book that talk about<div><br></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif;font-size:18px;line-height:23.3999996185303px">reverses the order of bytes in a binary</span><br></div><div><br></div><div>So my attempt looks like </div><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">58> B = <<1,2,3,4>>.</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)"><<1,2,3,4>></p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">59> binary_to_list(B).</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">[1,2,3,4]</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">60> lists:reverse(binary_to_list(B)).</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">[4,3,2,1]</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">61> list_to_binary(lists:reverse(binary_to_list(B))).</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)"><<4,3,2,1>></p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">62> </p></div><div><br></div><div><br></div><div>Wondering if there is a better way available. Any recommendations?</div><div><br></div><div>Thank you</div><div>+ Harit Himanshu</div></div>