tags:

views:

73

answers:

1

Is there any way to format this so it's a valid expression, without adding another step?

<<One:8,_:(One*8)>> = <<1,9>>.
* 1: illegal bit size

These work

>> <<One:8,_:8>> = <<1,9>>.              
<<1,9>>

>> One*8.
8

>> <<One:8,_:(1*8)>> = <<1,9>>.
<<1,9>>

>> <<Eight:8,_:Eight>> = <<8,9>>.  
<<8,9>>

I'm trying to parse a binary with nested data with binary list comprehensions instead of stacking accumulators.

+5  A: 

Try this ;-)

<<Size:8,_:Size/unit:8>> = <<1,9>>.
Hynek -Pichi- Vychodil
Thanks! That's perfect. In my case I set binary-unit:32 and the list comprehension I was messing with worked
Jimmy Ruska