[erlang-questions] Bit String Comprehension Question
Grasl Christoph
C.Grasl@REDACTED
Tue Sep 9 18:22:40 CEST 2008
sorry, however, for the noize dear david,
you need to declare that's a bitstring,
binaries is default and therefore the expected type,
so this will work 4 u:
<< <<Bin/bitstring>> || Bin <- [<<3:5>>] >>.
it's well explained in the documentation ('programming-examples/constructing binaries and bitstrings')..
Cheers,
Christoph Grasl
Embedded Software Entwickler
KEYTRONIX
Gesellschaft für industrielle Elektronik und Informationstechnologie mbH
Ungargasse 64-66/1/109
A-1030 WIEN
E-Mail: c.grasl@REDACTED
Tel.: +43 (1) 718 06 60 - 323
Mobil: +43 (664) 8556456
WWW: http://www.keytronix.com
HG Wien FN 261131t
Confidentiality Notice:
This message may contain privileged and confidential information. If you think, for any reason, that this message may have been addressed to you in error, you must not disseminate, copy or take any action in reliance on it, and we would ask you to notify us immediately by return email.
-----Ursprüngliche Nachricht-----
Von: David Mercer [mailto:dmercer@REDACTED]
Gesendet: Di 09.09.2008 17:52
An: Grasl Christoph; erlang-questions@REDACTED
Betreff: RE: [erlang-questions] Bit String Comprehension Question
My question, however, is regarding bit string comprehension, not list
comprehension. Please advise. Thank-you.
> -----Original Message-----
> From: Grasl Christoph [mailto:C.Grasl@REDACTED]
> Sent: Tuesday, September 09, 2008 09:55
> To: dmercer@REDACTED; erlang-questions@REDACTED
> Subject: AW: [erlang-questions] Bit String Comprehension Question
>
> Dear, David
>
> [Bin || Bin <- [<<3:5>>] ].
>
> works fine..
>
> the syntactical notation for a list comprehension needs to be in '[' & ]'
> whereas you have used the binary/bitstring syntax to 'bracket' your
> comprehension
> together with the '||', which is typically a list-comp.
> could be mistaken, but it looks like u'r mixing up to notations..
>
> Cheers,
>
> Christoph Grasl
> Embedded Software Entwickler
>
> KEYTRONIX
> Gesellschaft für industrielle Elektronik und Informationstechnologie mbH
>
> Ungargasse 64-66/1/109
> A-1030 WIEN
>
> E-Mail: c.grasl@REDACTED
> Tel.: +43 (1) 718 06 60 - 323
> Mobil: +43 (664) 8556456
> WWW: http://www.keytronix.com
>
> HG Wien FN 261131t
>
> Confidentiality Notice:
> This message may contain privileged and confidential information. If you
> think, for any reason, that this message may have been addressed to you in
> error, you must not disseminate, copy or take any action in reliance on
> it, and we would ask you to notify us immediately by return email.
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: erlang-questions-bounces@REDACTED im Auftrag von David Mercer
> Gesendet: Di 09.09.2008 16:18
> An: 'erlang-questions'
> Betreff: [erlang-questions] Bit String Comprehension Question
>
> Why does the bit-string comprehension #133 below work whereas #134 is a
> syntax error?
>
>
>
> 133> << <<X:N>> || {X,N} <- [{3,5}] >>.
>
>
> <<3:5>>
>
> 134> << Bin || Bin <- [<<3:5>>] >>.
>
> * 1: syntax error before: '||'
>
>
>
> Please advise. Thank-you.
>
>
>
> David Mercer
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080909/785cf65a/attachment.htm>
More information about the erlang-questions
mailing list