Peter Haworth wrote:
On Wed, 30 Oct 2002 15:31:24 -0800, Michael Lazzaro wrote:

Meaning that the list:

  +^    - force to numeric context, complement
  ~^    - force to string context, complement

simply becomes:

  ^     - complement (type-specific)

Does this include booleans? I really liked the idea that not and xor were
just the same operator, but unary/binary.  Otherwise, we have ! for boolean
negation only, while ^ does the same thing for other types, as well as xor
for everything. I don't mind leaving ! in as a synonym.
Perhaps C<!> is just a (preferred) synonym for C<?^>.

Which suggests:

    Unary:
         ^ X	  eval X in scalar context, then bitwise complement polymorphically
        ~^ X	  eval X in string context, then bitwise complement chars
        +^ X      eval X in numeric context, then bitwise complement number
        ?^ X	  eval X in boolean context, then bitwise complement bit
         ! X	  eval X in boolean context, then bitwise complement bit (preferred form)

    Binary Junctive:
        X ^ Y     eval X and Y in scalar context and form their exjunction
        X ~^ Y    eval X and Y in string context and form their exjunction
        X +^ Y    eval X and Y in numeric context and form their exjunction
        X ?^ Y    eval X and Y in boolean context and form their exjunction
        X ! Y     eval X and Y in boolean context and form their exjunction

    Binary Bitwise:
        X .^ Y    eval X and Y in scalar context and form their polymorphic bitwise XOR
        X ~.^ Y   eval X and Y in string context and form their charwise bitwise XOR
        X +.^ Y   eval X and Y in numeric context and form their bitwise XOR

    Binary Logical:
        X ?^^ Y   eval X and Y in boolean context and compute their XOR
        X !! Y    eval X and Y in boolean context and compute their XOR (preferred form)


In other words:

    Unary:    ^
    Junctive: ^
    Bitwise:  .^
    Logical:  ?^^

    String contextualizer prefix:     ~
    Numeric contextualizer prefix:    +
    Boolean contextualizer prefix:    ?

    Synonym for unary and binary ?^:  !
    Synonym for binary ?^^:           !!



Incidentally, that leaves C<^> free to be the unambiguous vectorizing prefix
(modulo the C<^+=> ambiguity). I still vastly prefer C<»op«> though.

Damian

Reply via email to