[#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:04076] Re: unpack and "bn" with n>16

From: ts <decoux@...>
Date: 2000-07-17 11:41:27 UTC
List: ruby-talk #4076
>>>>> "P" == Pixel  <pixel@mandrakesoft.com> writes:

 Well, if I'm right :

P> p "\0\0\0\0".unpack("b16b1b2") # -> ["0000000000000000", "0", "00"]

   unpack b16 from \0\0 
   unpack b1  from \0
   unpack b2  from \0

 here a little example :

moulon% ruby -e 'p "\0\0\1\3\1".unpack("b16b1b2b1")'
["0000000000000000", "1", "11", "1"]
moulon% 

P> p "\0\0\0\0".unpack("b17b1b1") # -> ["00000000000000000", "0", ""]

   unpack b17 from \0\0\0 (only 16 bits in \0\0 ==> it take the 17 bit in
                           the next \0)

   unpack b1  from \0
   unpack b1  from (nothing)


Guy Decoux

   


In This Thread

Prev Next