Binary comprehensions
Jay Nelson
jay@REDACTED
Fri Aug 13 02:43:35 CEST 2004
Has anyone requested binary comprehensions? Something like the following:
{ok, FileInput} = file:read_file("example.txt"),
Lowercase = << downcase(Char) || Char <- FileInput >>,
Printables = << R || R <- Lowercase, R > 32 >>,
HexNybbles = << integer(Byte) || Byte:4/binary <- FileInput >>,
Inverse = << flip(Bit) || Bit:1/binary <- FileInput >>,
...
Has the following restriction been lifted?
|Size| must be an integer literal, or a previously bound variable. Note
that the following is not allowed:
foo(N, <<X:N,T/binary>>) ->
{X,T}.
More information about the erlang-questions
mailing list