[erlang-questions] Reverses Order of Bytes in Binary

Harit Himanshu harit.subscriptions@REDACTED
Fri Jan 9 14:54:07 CET 2015

This is another exercise in Programming Edition book that talk about

reverses the order of bytes in a binary

So my attempt looks like

58> B = <<1,2,3,4>>.


59> binary_to_list(B).


60> lists:reverse(binary_to_list(B)).


61> list_to_binary(lists:reverse(binary_to_list(B))).



Wondering if there is a better way available. Any recommendations?

Thank you
+ Harit Himanshu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150109/7674c952/attachment.htm>

More information about the erlang-questions mailing list