Joe Gottman writes:
> 2)       Do all of the xor variants have the property that chained calls
> return true if exactly one input parameter is true?

I would imagine not.  C<xor> is spelled out, and by definition XOR
returns parity.  On the other hand, the junctive ^ (one()) is exactly
one.

> 
> 3)       Is there an ASCII digraph for the | operator?

No. Just use C<zip>. 

> 4)       Do "==" and "!=" participate in chained comparisons, so that $a ==
> $b == $c evaluates to true if and only if all three are equal?  

Yes.  But not really.  It evaluates true if $a == $b and $b == $c (while
only evaluating $b once).  This may not be the same as all three being
equal if $a, $b, and $c are objects whose equality isn't transitive.

> Is $x > $y < $z a legal chaining?  Or  $x < $y lt $z?

Sure.  It (rather confusingly) asks whether $y is less than both $x and
$z.  The latter is too, and it's equivalent to:

    $x < +$y and ~$y lt $z

> 5)       Would it be possible for me to create a user-defined operator that
> does chaining?

Yes. You just have to be clever about your return values.  A comparison
operator could return its right argument C<but true> or C<but false>.
To get them to short circuit is exactly the same problem as getting
other user-defined operators to short circuit, something that's been
adressed but I don't remember the answer to.

Luke

Reply via email to