in reply to Re: Bits & pieces
in thread Bits & pieces

Good job! Included below is an explanation of this JAPH which is a bit (ba-dum-bum) more verbose. Your analysis hit on the big points, but I wanted to fill in some of the more subtle reasoning.

Replies are listed 'Best First'.
Re^3: Bits & pieces
by jdalbec (Deacon) on Jul 19, 2005 at 03:01 UTC
    the two characters are negated in alternate calls to the closure.
    For that to be true, $_{64} would have to be '010101010101010101010101'. But I see that the output of the closure is more predictable than I had thought at first. The final result depends only on the last three (to some extent, six) characters of the string (in fact it's the same as the last character of the string).
    $O = 19, $C = ~$C& 0x4D; # bits 7+ all 0 $O = 20, $C = ~$C| 0x20; # bits 7+ all 1 $O = 21, $C = ~$C^ 0x70; # bits 7+ all 0 bits 6543210 $O = 22, $C = $C&~0x6F; # bits 7+ all 0 00?0000 $O = 23, $C = ~$C| 0x73; # bits 7+ all 1 1111111 $O = 24, $C = $C^~0x74; # bits 7+ all 0 1110100
    I see also that I was bitten by contexts again. The correct list of values for &$s in scalar context is
    # 0 4294967295 105 8 4294967263 73 8 4294967263 77 4 4294967291 +53 # 0 4294967295 116 20 4294967263 112 13 4294967282 125 16 4294967295 1 +16