in reply to Useful uses of Quantum::Superpositions?
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 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Useful uses of Quantum::Superpositions?
by Anonymous Monk on Apr 04, 2003 at 07:07 UTC | |
by diotalevi (Canon) on Apr 04, 2003 at 07:15 UTC | |
by feanor_269 (Beadle) on Apr 08, 2003 at 16:51 UTC | |
by diotalevi (Canon) on Apr 08, 2003 at 17:06 UTC | |
by Mr. Muskrat (Canon) on Apr 08, 2003 at 17:17 UTC | |
by feanor_269 (Beadle) on Apr 09, 2003 at 19:40 UTC | |
| |
by Anonymous Monk on Apr 04, 2003 at 07:08 UTC |