in reply to 'Holy in one' another Golf Game!

Here's my despoiled contribution:
22 chars...
sub sel { $_[0]&~$_[2]|$_[1]&pop }
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re^2: 'Holy in one' another Golf Game!
by tadman (Prior) on Jul 27, 2001 at 13:02 UTC
    Maybe you could explain your interpretation of the problem, because it seems ambiguous to me. 18 characters, and it does some stuff:
    sub X { (1<<pop)&(pop|pop) }
    Here I'm presuming $a and $b are two values, and that a third parameter $c indicates which bit is required, such that if $c were 4, the 4th bit was extracted (24 or 16) and returned as is, with the 4th bit being either 1 or 0 as was in the input.

    Pop. Pop. Pop.

    Update:
    My reply fell of the edge of the world, so I've reproduced it here: 20 characters:
    sub X{ ($_=pop)&pop|~$_&pop }
      You have the right idea, but extrapolate it for all the bits of $a, $b, and $c. The $c is essentially a multichannel multiplexer for inputs $a and $b. It specifies whether to select the bit from $a or $b for each digit of the output.

      So with:

      my $a = 0b10101010; my $b = 0b11001100; my $c = 0b11110000; #result: 11001010
         MeowChow                                   
                     s aamecha.s a..a\u$&owag.print
        When you said "multichannel multiplexer" it all made sense. How about this one, at 20 characters:
        sub X{ ($_=pop)&pop|~$_&pop }