Message from discussion
Bad Argument, (Bug or something I'm missing).
Received: by 10.204.129.9 with SMTP id m9mr1194629bks.1.1349081218797;
Mon, 01 Oct 2012 01:46:58 -0700 (PDT)
X-BeenThere: erlang-programming@googlegroups.com
Received: by 10.204.131.72 with SMTP id w8ls6401150bks.3.gmail; Mon, 01 Oct
2012 01:46:58 -0700 (PDT)
Received: by 10.204.130.7 with SMTP id q7mr1196756bks.2.1349081218394;
Mon, 01 Oct 2012 01:46:58 -0700 (PDT)
Received: by 10.204.130.7 with SMTP id q7mr1196755bks.2.1349081218364;
Mon, 01 Oct 2012 01:46:58 -0700 (PDT)
Return-Path: <erlang-questions-boun...@erlang.org>
Received: from hades.cslab.ericsson.net (hades.cslab.ericsson.net. [192.121.151.104])
by gmr-mx.google.com with ESMTP id k7si1476765bks.2.2012.10.01.01.46.58;
Mon, 01 Oct 2012 01:46:58 -0700 (PDT)
Received-SPF: pass (google.com: domain of erlang-questions-boun...@erlang.org designates 192.121.151.104 as permitted sender) client-ip=192.121.151.104;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of erlang-questions-boun...@erlang.org designates 192.121.151.104 as permitted sender) smtp.mail=erlang-questions-boun...@erlang.org; dkim=neutral (body hash did not verify) header...@gmail.com
Received: from hades.cslab.ericsson.net (hades [192.121.151.104])
by hades.cslab.ericsson.net (Postfix) with ESMTP id 6328A5C0BB;
Mon, 1 Oct 2012 10:46:53 +0200 (CEST)
X-Original-To: erlang-questi...@erlang.org
Delivered-To: erlang-questi...@erlang.org
Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
[74.125.82.181])
by hades.cslab.ericsson.net (Postfix) with ESMTP id BA0D35C009
for <erlang-questi...@erlang.org>; Mon, 1 Oct 2012 10:46:51 +0200 (CEST)
Received: by weyu54 with SMTP id u54so2881568wey.40
for <erlang-questi...@erlang.org>; Mon, 01 Oct 2012 01:46:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=mime-version:sender:in-reply-to:references:date
:x-google-sender-auth:message-id:subject:from:to:cc:content-type;
bh=pI+E1/miAuSim0hvv2MKeuXEDwt8In4B59gWLNibHAE=;
b=FVoY7BSVzv+1803kYlmBYYQP3sJToHMaX/26/PNW+DjFV1RvVnZzFK6isxKAq0ccrb
XlEY8wV5DCZDlzJ0zs/bR4qjh3wvCBbMun6C7stvgyUyuMH36YZjygUvxTr5JmPQjXqJ
qJpGzYSyb5HG3ZY/rKv4a33nM9ATJQJEs0caP+VMJMVhKTOpaEvUBXFEpGAu26gDU6nt
aL6Z1dCsVDSTktzP9VEtIWMEqKF/LdOLL4Kt2QNAV94FWjv/kd4txGraj9ERvqj1jCPQ
vX4OMO134gcEL3awaLnOL+aTxJ08mU26RI6gO5f9vwssc/aNjdeQGM3oShM+sz+thzZ/
pbHw==
MIME-Version: 1.0
Received: by 10.180.105.6 with SMTP id gi6mr13074355wib.4.1349081211377; Mon,
01 Oct 2012 01:46:51 -0700 (PDT)
Received: by 10.223.69.135 with HTTP; Mon, 1 Oct 2012 01:46:51 -0700 (PDT)
Received: by 10.223.69.135 with HTTP; Mon, 1 Oct 2012 01:46:51 -0700 (PDT)
In-Reply-To: <CAJQBG12Ww5VUD7+Wik2gzx3HJwBaJJYkKLaBF=86ooWkV7p...@mail.gmail.com>
References: <CAJQBG12Ww5VUD7+Wik2gzx3HJwBaJJYkKLaBF=86ooWkV7p...@mail.gmail.com>
Date: Mon, 1 Oct 2012 03:46:51 -0500
Message-ID: <CAPTXyXcfPi_t0gn5pyRrRXkXPYuotjEKfpPdNaisfJ82Kz7...@mail.gmail.com>
From: Jesse Gumm <g...@sigma-star.com>
To: Chris Cook <cookchr...@gmail.com>
Cc: erlang-questi...@erlang.org
Subject: Re: [erlang-questions] Bad Argument, (Bug or something I'm missing).
X-BeenThere: erlang-questi...@erlang.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: General Erlang/OTP discussions <erlang-questions.erlang.org>
List-Unsubscribe: <http://erlang.org/mailman/options/erlang-questions>,
<mailto:erlang-questions-requ...@erlang.org?subject=unsubscribe>
List-Archive: <http://erlang.org/pipermail/erlang-questions>
List-Post: <mailto:erlang-questi...@erlang.org>
List-Help: <mailto:erlang-questions-requ...@erlang.org?subject=help>
List-Subscribe: <http://erlang.org/mailman/listinfo/erlang-questions>,
<mailto:erlang-questions-requ...@erlang.org?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============5818569581136043654=="
Errors-To: erlang-questions-boun...@erlang.org
Sender: erlang-questions-boun...@erlang.org
--===============5818569581136043654==
Content-Type: multipart/alternative; boundary=f46d04428cc860995004cafb72a0
--f46d04428cc860995004cafb72a0
Content-Type: text/plain; charset=ISO-8859-1
Hi,
You just need to convert List to a binary first with list_to_binary.
The <<"something">> syntax is just a friendly way to make binary literals.
But it does not perform automatic casting of lists.
Further, the extra << >> you're wrapping around "-" is unnecessary.
Example:
> L = "123456",
> B = list_to_binary(L),
> <<B/binary,"-">>.
Will yield:
<<"123456-">>
Hope that helps.
Take it easy,
-Jesse
--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm
On Oct 1, 2012 3:11 AM, "Chris Cook" <cookchr...@gmail.com> 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".
> "89234789234jhk2hk234892789fauky324978"
> 2> <<List, <<"-">>/binary>>.
> ** exception error: bad argument
>
> But when I write it as this,
>
> 3> <<"89234789234jhk2hk234892789fauky324978", <<"-">>/binary>>.
> <<"89234789234jhk2hk234892789fauky324978-">>
>
> 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.
>
> Regards
>
> Chris Cook.
> _______________________________________________
> erlang-questions mailing list
> erlang-questi...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions
>
--f46d04428cc860995004cafb72a0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<p>Hi,</p>
<p>You just need to convert List to a binary first with list_to_binary.</p>
<p>The <<"something">> syntax is just a friendly way =
to make binary literals. But it does not perform automatic casting of lists=
.</p>
<p>Further, the extra << >> you're wrapping around "-&=
quot; is unnecessary.</p>
<p>Example:</p>
<p>> L =3D "123456",<br>
> B =3D list_to_binary(L),<br>
> <<B/binary,"-">>.</p>
<p>Will yield:</p>
<p><<"123456-">></p>
<p>Hope that helps.</p>
<p>Take it easy,</p>
<p>-Jesse</p>
<p>--<br>
Jesse Gumm<br>
Owner, Sigma Star Systems<br>
414.940.4866 || <a href=3D"http://sigma-star.com">sigma-star.com</a> || @je=
ssegumm</p>
<div class=3D"gmail_quote">On Oct 1, 2012 3:11 AM, "Chris Cook" &=
lt;<a href=3D"mailto:cookchr...@gmail.com">cookchr...@gmail.com</a>> wro=
te:<br type=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"marg=
in:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Morning list,<br>
<br>
I have,<br>
<br>
Erlang R15B01 (erts-5.9.1) [source] [async-threads:0] [hipe] [kernel-poll:f=
alse]<br>
<br>
Eshell V5.9.1 =A0(abort with ^G)<br>
1> List =3D "89234789234jhk2hk234892789fauky324978".<br>
"89234789234jhk2hk234892789fauky324978"<br>
2> <<List, <<"-">>/binary>>.<br>
** exception error: bad argument<br>
<br>
But when I write it as this,<br>
<br>
3> <<"89234789234jhk2hk234892789fauky324978", <<&q=
uot;-">>/binary>>.<br>
<<"89234789234jhk2hk234892789fauky324978-">><br>
<br>
I get the result I expected to get from the above 1 & 2. Could someone<=
br>
please explain what is going wrong and why, because I'm very confused<b=
r>
with it.<br>
<br>
Regards<br>
<br>
Chris Cook.<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href=3D"mailto:erlang-questi...@erlang.org">erlang-questi...@erlang.org<=
/a><br>
<a href=3D"http://erlang.org/mailman/listinfo/erlang-questions" target=3D"_=
blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>
--f46d04428cc860995004cafb72a0--
--===============5818569581136043654==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
--===============5818569581136043654==--