in reply to Can you spot the problem?

One cute thing is that all the false negatives (or false positives) are actually solution spaces. So, Abigail-II's solution of 200.0.0.1 actually is the solution space containing the elements 200, 0, 0, and 1. So, 1.200.0.0 also is a false negative (for the same reason). (The symmetry is caused by the bit-wise OR, not by the issue at hand.)

As for fixes ... I would think that this should be something Perl5 should handle through dwimmery (and something it seems that Perl6 will be handling more intelligently, at least according to TheDamian's discussion on sorting ...)

(And, if I get dinged on providing too much of a hint, at least I got someone interested in the differences between Perl5 and Perl6's sorting ... *grins*)

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re: Can you spot the problem?
by TimToady (Parson) on Mar 05, 2004 at 19:45 UTC
    Well, depends on how you decide to fix it in Perl 6. The code as written will do superpositional logic, but it will only tell you if one of the numbers is less than 256. You'd have to use & instead of | to do a conjunction.

    If, on the other hand, you try to keep the bitwise-OR semantics, Perl 6 will force you to pick between ~| and +|, and if you pick the obvious one, it numerifies the string and works as intended. So I think Perl 6 is improving things in this area...er, as long as you don't forget and try to use | or & for bit operations. Doubtless that will be a cultural issue for a while...