Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Quantum::Superpositions problem

by ikegami (Pope)
on Sep 15, 2008 at 12:26 UTC ( #711440=note: print w/replies, xml ) Need Help??

in reply to Quantum::Superpositions problem

Bug. In fact, if I run the example in the documentation, I don't get the documented results.
use strict; use warnings; use Quantum::Superpositions; print(Quantum::Superpositions->VERSION(), "\n"); if (all(1,2,3)*any(5,6) < 21) { print "no alcohol\n"; } if (all(1,2,3)*any(5,6) < 18) { print "no entry\n"; } if (any(1,2,3)*all(5,6) < 18) { print "under-age\n" } print(all(1,2,3)*any(5,6), "\n"); print(all(1,2,3)*any(5,6), "\n"); print(any(1,2,3)*all(5,6), "\n");

I get:

2.02 no alcohol no entry all(any(6,5),any(10,12),any(18,15)) all(any(6,5),any(10,12),any(18,15)) any()

The documentation says I should get:

2.02 no alcohol under-age all(5,6,10,12,15,18) all(5,6,10,12,15,18) any(5,6,10,12,15,18)

The bug might have been introduced by this change in 2.00:

Replaced the cross product with an iterator. this means that any(@these) != all(@those) does not need to generate the full cartesian product up front. The prime sieve (demo/demo_Primes) now runs in reasonable time/memory.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://711440]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2018-06-23 05:18 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.