Jano Svitok
8/12/2006 7:49:00 PM
On 8/12/06, snacktime <snacktime@gmail.com> wrote:
> On 8/12/06, Jan Svitok <jan.svitok@gmail.com> wrote:
> > On 8/12/06, snacktime <snacktime@gmail.com> wrote:
> >
> > > even_bits = "\0"
> > > odd_bits = "\200"
> > > 8.times do
> > > even_bits << odd_bits
> > > odd_bits = even_bits
> > > odd_bits.tr!("\0\200","\200\0")
> > > end
> > >
> > > print odd_bits.unpack('c*')
> >
> > - odd_bits = even_bits
> > + odd_bits = even_bits.clone
> >
> > = assigns reference to the object in this case
> >
> >
> Ok now I feel stupid:) Thanks for pointing that out.
Well, I looked at it for quite a long time before I realized what's
going on: at first I replaced your strings with 'A's and 'B's as these
are easier to recognize, then I tried 'AA-AB-BA-BB'.tr(...) and both
versions were ok. So it wasn't a tr problem. Soon after that the
inspiration came... ;-)
You're welcome.
J.