[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04080] Re: unpack and "bn" with n>16

From: Pixel <pixel@...>
Date: 2000-07-17 12:19:35 UTC
List: ruby-talk #4080
Aleksi Niemel<aleksi.niemela@cinnober.com> writes:

> I guess you're expecting the successive "b1b2b3b2" to consume only one byte
> whereas it eats the four.

yeah!

i should have tried pack to understand it:

p ["1","0"].pack("b2b1") #-> "\001\000\000", aka 3*8bits long


is there any way to do what i meant to do? aka

p ["1", "1", "1","1"].pack("b4b2b1b1") 
#-> [ 0b00010111 ].pack("C")
#-> "\027"


thanks, cu Pixel.

In This Thread

Prev Next