RSS | Module Info | Add a review of Quantum-Superpositions
Quantum::Superpositions /
Quantum-Superpositions
(2.02)
While Quantum::Superpositions might take a little getting used to, it's swiftly become one of the oft-used weapons in my arsenal, as it lets me get around writing horrible spaghetti nested loops of code in many instances. Instead I can turn out code that looks much more Perl-ish, and in fact this module should be part and parcel of Perl 6 if I've read things correctly.
#!/usr/bin/perl
use warnings; use strict;
my @Array1 = qw(cat dog mouse rat);
my @Array2 = qw(mouse bird rat snake);
use Quantum::Superpositions;
my @notinarray1 = map { $_ }
eigenstates( any(@Array2) ne all(@Array1) );
my @notinarray2 = map { $_ }
eigenstates( any(@Array1) ne all(@Array2) );
print "@notinarray1: not found in Array 1\n",
"@notinarray2: not found in Array 2\n";
Look Ma! No nested loops!
webdragon - 2003-08-25T23:55:09 (permalink)
4 out of 4 found this review helpful.
Was this review helpful to you?
Yes
No

