Resending to list....

On Fri, May 29, 2009 at 9:53 PM, Darren Duncan <dar...@darrenduncan.net> wrote:
> I had some thoughts lately about the Perl 6 operators, and wanted to bounce
> some ideas.
>
> --------
>
> Secondly, regarding the Bool type, I think it would be useful for Perl 6 to
> define the full complement of dyadic logical operators, of which I count a
> few that you don't appear to already have.  Probably the best place is in
> Synopsis 32.

There are 16 dyadic logical operators, not all of which make sense to
have.    You name 10.

>
> Note that all the dyadic ops I am discussing are meant to be read as infix
> ops only.
>
> These are the boolean/logical ops you already have:
>
> Niladic ops aka value literals / constants:
> * Bool::False
> * Bool::True
>
> Monadic:
> * not aka !, but ¬ alias could be added
>
> Dyadic:
> * and aka &&, but ∧ alias could be added
> * or aka ||, but ∨ alias could be added
> * xor aka ^^ aka !===, but ⊻, ↮ aliases could be added
> * ===, but xnor, ↔ aliases could be added

I'm certain I know the semantics of these (and chooses the minimum of
the two, or the maximum, xor checks for difference, xnor checks for
sameness), but I'm uncertain of some of the rest...

>
> But here are a few more dyadic:
> * nand aka ⊼ aka ↑
true unless both operands are true

> * nor aka ⊽ aka ↓
true if both operands are false

> * implies aka imp aka →
true unless left operand true and right operand false.

> * nimp aka ↛
true if left operand true and right operand false?

> * if aka ←
true unless left operand false and right operand true

> * nif aka ↚
true if left operand false and right operand true?

The other six, which don't depend on the value of both operands, would
(if they existed) have the names false, left, right, nright, nleft,
and true.

>
> For that matter, as you know, every single boolean/logical operator could
> also have a bitwise analogue, if people were so inclined.
>
> --------
>
> Thirdly, there are I'm sure a number of other aliases that could be added to
> other ops, such as ≤ and ≥ for <= and >=, and ≠ for one of the inequality
> operators, although that last one would probably make more sense if = was
> the equality test operator, so maybe best to avoid ≠ then.

Perhaps ≡ and ≢ as aliases?

Reply via email to