In Elixir/Erlang one can do this kind of pattern matching / deconstruction over binaries and bitstrings:
def func1(my_data) do << 15, 14, a::little-64, b::little-16, c, d::64-little, e::32-little-float, rest::binary >> = my_data # using a, b, c, d, e, rest end
I’ve not found a way to do that in OCaml. Is there such out of the box capacity? Or is utilizing some third-party library required?