Allow me to clarify runrig's answer in case it didn't make sense to you. all(1,4) == all(1,4) would be true if 1 == all(1,4) and 4 == all(1,4).

For the first statement to be true we must have 1 == 1 and 1 == 4 Since 1 is not 4, the first one is false.

The second one is false for the same reason. A fact that we didn't actually need to check since the failure of either the first or the second statement is enough to make the overall comparison fail.

Therefore in quantum logic, all(1,4) != all(1,4), no matter how much that violates your classical prejudices.

And that is why the match that you expected to find in the more complex example, wasn't found.

UPDATE Here is a simple example to make you think that the way that Quantum::Superpositions works is reasonable. Just read the statement all(1, 2, 3) < all(4, 5, 6) as plain English. All of (1, 2, 3) are less than all of (4, 5, 6). Which is true. So the code evaluates to true. By contrast all(1, 2, 4) < all(3, 5, 6) says that All of (1, 2, 4) are less than all of (3, 5, 6). Which is false because 4 is not less than 3. And so the code evaluates to false.

And this is exactly how Quantum::Superpositions works. When you read all(1,4) == all(1,4), don't think of all(1,4) as a "thing" in and of itself. It isn't. Think of the whole statement as being a sentence asserting something, and think about whether that assertion is correct.

Yes, at some level all(1,4) has to be a single Perl scalar. But the illusion is that it isn't, and with TheDamian doing the illusioning, you can bet that it is a pretty darned good illusion!


In reply to Re: Nested Quantum::Superpositions by tilly
in thread Nested Quantum::Superpositions by welchavw

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.