[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Golf (7, er 16 strokes is par!)



In message <Pine.GSO.4.21.0005021143260.5465-100000@crusoe.crusoe.net>,
    Jeff Pinyan writes:

: On May 2, Bennett Todd said:
: 
: >which comes to 14 if I count right. Sure is a shame that there isn't
: >a ^^ operator, which like && and || would treat its args as booleans
: >rather than bitstrings. They could have done that when they
: >introduced xor, but as best I can tell they didn't.
: 
: Camel, ed. 2, pg. 94:
: 
:   There is also a logical B<xor> operator that has no exact counterpart in
:   C or Perl, since the other XOR operator (^) works on bits.  The best
:   equivalent for C<$a xor $b> is perhaps C<!$a != !$b>[1].  This operator
:   can't short-circuit either, since both sides must be evaluated.
: 
:   [1] One could write C<!$a ^ !$b> or even C<$a ? !$b : !!$b>, of course.

We didn't put in ^^ because then we'd have to keep telling people what
it means, and then we'd have to keep telling them why it doesn't short
circuit.  :-/
             -- Larry Wall in <199707300650.XAA05515@wall.org>

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe