http://www.perlmonks.org?node_id=162715


in reply to TIMTOWTDI and other languages

Warning: untested code ahead!
Quantum::Superpositions :)
use Quantum::Superpositions; my @alphas = qw/ 9 4 3 2 22 13 7 140 95 278/; my @betas = qw/ 8 3 4 1 278 94 15 7 19 200/; my @results; for my $element (@alphas) { if ($element == any(@betas)) { push @results, $element; } } print "Results: ", (sort{ $a <=> $b }@results), "\n";
jynx

Replies are listed 'Best First'.
Re: Re: TIMTOWTDI and other languages
by TheDamian (Vicar) on Apr 30, 2002 at 03:57 UTC
    ...or, even easier:
    use Quantum::Superpositions; my @alphas = qw/ 9 4 3 2 22 13 7 140 95 278/; my @betas = qw/ 8 3 4 1 278 94 15 7 19 200/; my @results = eigenstates( any(@alphas) == any(@betas) );