[erlang-questions] Bit String Comprehension Question
David Mercer
dmercer@REDACTED
Tue Sep 9 17:52:44 CEST 2008
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
>
>
>
>
>
More information about the erlang-questions
mailing list