[erlang-questions] binary_comprehension support

Bjorn Gustavsson bjorn@REDACTED
Tue May 29 12:19:51 CEST 2007


Standard disclaimer: Binary comprehensions are an experimental feature,
and there may be changes in it (even incompatible), before it is officially
supported. :-)

How to get your example work:

-module(test).
-compile([export_all, bitlevel_binaries, binary_comprehension]).

foo(Bin) -> [ X || <<X:8>> <= Bin].

/Björn

"Matthew O'Gorman" <mogorman@REDACTED> writes:

> Hi i was toying around with binary comprehension support but I cant
> get a simple test of it to work for example
> -module(test).
> -compile([export_all, binary_comprehension]).
> 
> foo(Bin) -> [ X || <<X:8>> <- Bin].
> 
> wont work no matter what type of binary i put in,  I have r11b4 and
> binary_comprehension turned on in my compile flag but i get the
> following error.
> 
> (mog@REDACTED)9> test:foo(<<1:8, 2:8>>).
> 
> =ERROR REPORT==== 29-May-2007::01:17:49 ===
> Error in process <0.91.0> on node 'mog@REDACTED' with exit value:
> {function_clause,[{test,'-foo/1-lc$^0/1-0-',[<<2
> bytes>>]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}
> 
> ** exited: {function_clause,[{test,'-foo/1-lc$^0/1-0-',[<<1,2>>]},
>                              {erl_eval,do_apply,5},
>                              {shell,exprs,6},
>                              {shell,eval_loop,3}]} **
> (mog@REDACTED)10>
> 
> 
> anyone have experience with this new feature?
> 
> mog
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB




More information about the erlang-questions mailing list