[erlang-questions] Bad Argument, (Bug or something I'm missing).
Mon Oct 1 10:43:53 CEST 2012
If you just do
2> L = "a",<<L>>.
** exception error: bad argument
You get the same behaviour. When you do <<"a">> it is just syntactic
sugar for << <<97>>/binary >>. However when passing the value as a
variable you do not get the syntactic sugar help so you have to do
3> L = "a",<<(list_to_binary(L))/binary>>.
or something to that effect to get the correct result. Hope that makes sense.
On Mon, Oct 1, 2012 at 10:11 AM, Chris Cook <> wrote:
> Morning list,
> I have,
> Erlang R15B01 (erts-5.9.1) [source] [async-threads:0] [hipe] [kernel-poll:false]
> Eshell V5.9.1 (abort with ^G)
> 1> List = "89234789234jhk2hk234892789fauky324978".
> 2> <<List, <<"-">>/binary>>.
> ** exception error: bad argument
> But when I write it as this,
> 3> <<"89234789234jhk2hk234892789fauky324978", <<"-">>/binary>>.
> I get the result I expected to get from the above 1 & 2. Could someone
> please explain what is going wrong and why, because I'm very confused
> with it.
> Chris Cook.
> erlang-questions mailing list
More information about the erlang-questions