Well sure - who couldn't use the any() and all() functions? They're so useful that perl6 included them in the core. The idea is that you can say something like 5 == any( 1 .. 10 ) and have it evaluate true because one of the possible expressions is true. Similarly, all( 'marsh', 'munchkin', 'mink') =~ /^m/ would also be true because all the expressions evaluate to true. Obviously this is something that can be done in perl5 - it just requires more code.

Now as for actually using Q::S ... no. Its heavier weight than I'd prefer. My most common wish is for the two disjunctions - any of a list of regexes being true and any of a list of strings being equal. I just do those up as plain subs but its not as pretty as perl6 will let me be.

sub qrany { $_ =~ $_[0] and return 1 for @_[ 1 .. $#_ ]; return 0 } sub eqany { $_ eq $_[0] and return 1 for @_[ 1 .. $#_ ]; return 0 }

In reply to Re: Useful uses of Quantum::Superpositions? by diotalevi
in thread Useful uses of Quantum::Superpositions? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.