[erlang-questions] How to pass the length of binary to match into a function that matches the binary?

Russell Brown russelldb@REDACTED
Mon Nov 24 13:56:23 CET 2014


Hi,
Is there a way to do this:

my_fun(Bin, Len, <<Bin:Len/binary, Rest/binary>>) ->
	%% do stuff with Bin
	ok.

Len is unbound is the reason I can’t, but it seems like the sort of thing that would be useful if I could.

Many thanks in advance

Russell


More information about the erlang-questions mailing list