diotalevi,
I could not find a single example of the binding operator anywhere in the documentation for
Quantum::Superpositions. I did however find the following code interesting:
#!/usr/bin/perl
use Quantum::Superpositions;
$\ = $/;
# Create a disjunction of 'a' and 'b'.
$dis = any( 'a', 'b' );
print $dis;
print "=~: ",$dis =~ /\bb\b/; # true
print "eq: ",$dis eq 'b'; # true
I do believe Perl 6's built in any will work with the binding operator. I also took a peak under the hood of the module itself. I could not find a binding operator listed:
q{<} => sub { qblop(swap(@_), sub { $_[0] < $_[1] })},
q{<=>} => sub { qblop(swap(@_), sub { $_[0] <=> $_[1] })},
... all kinds of other tests
q{~} => sub { $_[0]->quop(sub { ~$_[0] })},
Happy hunting!
Cheers - L~R
Update: I guess I spent too long digging around under the hood as Matt beat me to the punch.
Update 2: Chmrr reminded me that ~ is bitwise negation and that the binding operator can't be overloaded - see perldoc overload - Chmrr++
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.