unary (prefix) operators:
\ - reference to
* - list flattening
? - force to bool context
! - force to bool context, negate
not - force to bool context, negate
+ - force to numeric context
- - force to numeric context, negate
~ - force to string context
. - method call on current topic
- unary xor [no cooresponding operator]
++ - preincrement
-- - predecrement
unary (postfix) operators:
++ - postincrement
-- - postdecrement
... - [maybe] same as ..Inf
other postfix operators:
() - (when operator is expected)
[] - array access
{} - hash access
magical whitespace modifier
_ - remove whitespace/newline
hyperoperators:
^ - as prefix to any unary/binary operator, "vectorizes" the operator
binary operators:
+ - * / % ** x xx ~
+= -= *= /= %= **= x= xx= ~=
< > <= >= == != <=>
lt gt le ge eq ne cmp
&& || \\ // - boolean operations
&&= ||= \\= //=
and or xor err
.& .| .\ << >> - bitwise or charwise operations
.&= .|= .\= <<= >>= - (depending on operants)
- [or maybe +& vs ~&, etc.]
?& ?| ?\ - [maybe] bitwise operations on bools (as
in C)
?&= ?|= ?\= - (result is always 1 or 0)
& | \ ! - superpositional operations
&= |= \= - intersection, union, disjunction
all any one none
sum prod cat reduce
~~ !~ - smartmatch, perl5 =~,!~
=> - pair creator
, - list creator
; - "greater comma", list-of-lists creator
: - adverbial
. - method call
.. - range
... - [maybe] range, exclusive of endpoint
= - assignment
:= - binding
::= - binding, but more so
trinary operator:
?? :: - if/else
parens, misc, and quotelike operators
()
[] - [when term is expected]
{} - [when term is expected]
m// - shorthand, "matches"
s/// - shorthand, "substitute"
tr/// - shorthand, "transliterate"
'...' "..." `...` /.../ << >>
q qq qx rx qw
(+ qr ?)
(heredocs) - [exact format unknown]
named unary (prefix) operators, terms, and other assorteds, identified
when possible:
-X - [op] filetest operators
temp - [op]
let - [op]
ref - [op]
defined - [op]
undef - [op]
undef - [term]
exists - [op]
delete - [op]
but - [op] val properties
${ } - [deref] dereference scalarref
@{ } - [deref]
%{ } - [deref]
&{ } - [deref]
... - [term] yada**3
Inf - [term]
Nan - [term]
is - [declar] var properties
-> - [declar] like 'sub'
hash - [declar] force hash context
explicit radix specifications for integers:
0123 - decimal
2:0110 - binary (also b:0110?)
8:123 - octal (also o:123?)
16:123 - hex (also h:123?)
256:192.168.1.0 - base 256
(...etc...)
other uncategorized:
my our - [declar]
map grep
sqrt log sin cos tan (etc...) - math
lc lcfirst uc ucfirst
int ord oct hex bin
s/operants/operands/
Sorry bout that. Typing too fast.
MikeL
I mislike \ for xor, primarily because it doesn't fit into the current
"escape" mystique of \.
Larry
$zero = $a xor $a;
$a xor= $b;
$b xor= $a xor= $b xor= $a; # Swap'em
@a ^xor= @b; # Is this right?
=Austin
__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/
Does xor really need the punctuation? Does xor really need to be a
primitive?
-Scott
--
Jonathan Scott Duff
du...@cbi.tamucc.edu
Though bitwise xor is seldom used for most people, other versions are
likely to be more frequent: the 'superpositional' flavor, for example,
is likely to have significant meaning. Same with 'none', I expect.
& | \ !
all any one none
So supporting a punctuation for xor-like operations is more useful than
it might at first appear.
MikeL
Maybe. How do we get at the eigenstates of a superposition? The
punctuation for one and none could go away if could just count the
eigenstates.
Well, I don't believe in "none" since it's really easy to say !any(), but
exclusive-or can certainly use the punctuation. Or, actually, I'm currently
thinking, non-punctuation. I kept thinking to myself that it's a shame
that x is already taken, and then I looked crosseyed at the // vs \\
proposals, and I realized we have a superposition of / and \ that is
spelled "X". :-)
So at the moment I'm thinking we have
$a X $b # super xor
$a XX $b # logical high precedence xor
$a X= $b # assignment xor
$a +X $b # intbits xor
$a ~X $b # strbits xor
$a ^XX $b # hyper xor
$a xor $b # low precedence xor
+X $a # int complement
~X $a # str complement
Larry
Hmm. I wonder if people aren't going to expect some relationship
between x and X ..
> So at the moment I'm thinking we have
>
> $a X $b # super xor
> $a XX $b # logical high precedence xor
> $a X= $b # assignment xor
> $a +X $b # intbits xor
> $a ~X $b # strbits xor
> $a ^XX $b # hyper xor
> $a xor $b # low precedence xor
> +X $a # int complement
> ~X $a # str complement
And presumably these as well?
$a ^X= $b # hyper assignment xor
$a ^+X $b # hyper intbits xor
$a ^~X $b # hyper strbits xor
$a ^xor $b # hyper low precedence xor
^+X $a # hyper int complement
^~X $a # hyper str complement
Sometimes when I look at stuff like this I start to Cozenify and ask
myself "what language is this again?"
use Perl::Caseless;
print "foo" x 6; #?!?
--Brent Dax <bren...@cpan.org>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)
Wire telegraph is a kind of a very, very long cat. You pull his tail in
New York and his head is meowing in Los Angeles. And radio operates
exactly the same way. The only difference is that there is no cat.
--Albert Einstein (explaining radio)
> Well, I don't believe in "none" since it's really easy to say !any()
Does that have any implications for "unless"?
--
Paul Johnson - pa...@pjcj.net
http://www.pjcj.net
"nor"? Maybe it's "$a nor $b"?
MikeL
No. "unless" reads well in English. How do your read $a ! $b ! $c?
(When I said I don't believe in "none", I was referring to the infix
operator. I think none($a,$b,$c) is okay.)
Larry
oh no! You've said "nor", so now I have have to ask about "nand" ...
and the next thing you know perl takes over the world of circuit
design. :-)
=Austin
Then dont forget full tristate logic too :)
Graham.
You said above that you've prefer to say (presumably) "not any", using
"!any", rather than "none", which makes me suspect you're using "!" as
"not", so I'd read that "a not b not c", which doesn't make amazing
amounts of sense.
--
Wouldn't it be wonderful if real life supported control-Z?
> How do we get at the eigenstates of a superposition?
We obviously need another operator! <ducks>
Actually, I think we need a universal method on scalars that
gives the eigenstates of that value. It might be C<$val.eigenstates>
or maybe just C<$val.states>. The method would work on non-superimposed
values as well, in which cases it would just return a list containing
the value itself.
> The punctuation for one and none could go away if could just
> count the eigenstates.
Yes, but this:
if ($x | $y | $z == 7).states == 1 {...}
aren't nearly as nice as this:
if $x ^ $y ^ $z == 7 {...}
which means everyone will probably write:
if none($x,$y,$z) == 7 {...}
which is probably the right solution anyway ;-)
Damian
Sure, but I'd leave the name "eigenstates" just so the casual
programmer knows they're dealing with something from another
universe if they happen to run across it :-)
> How do your read $a ! $b ! $c?
"Neither $a nor $b nor $c".
What? Aren't you able to see this invisible "neither" operator just at
the front? ;-)
/L/e/k/t/u
>>Actually, I think we need a universal method on scalars that
>>gives the eigenstates of that value. It might be C<$val.eigenstates>
>>or maybe just C<$val.states>. The method would work on non-superimposed
>>values as well, in which cases it would just return a list containing
>>the value itself.
>
> Sure, but I'd leave the name "eigenstates" just so the casual
> programmer knows they're dealing with something from another
> universe if they happen to run across it :-)
But they're *not*, that's the point. This stuff just ain't that hard.
It's just set theory with a few interesting behaviour variations
that make it act more like natural English.
Much more on this in the next few posts.
Damian