Patrick R. Michaud wrote:
Funny. I thought $x would contain 'true' here, since C<and> was a boolean operator. But I could be very wrong.Even if you fixed the =/and precedence with parens, to read
my $x = (any(2,3,4,5) and any(4,5,6,7));
then I think the result is still that $x contains any(4,5,6,7).
The overall impression I'm getting here is that we need some syntax for saying:
$x = any(1..1000) such_that is_prime($x);
where "such_that" acts as a form of "junctive grep". so the above might mean the same as:
$x = any(1..1000 ==> grep(is_prime($_)));
We then can say that any junction stored in a var stays constant, until explicitly reassigned. Just like every other kind of thing we store.
Philosophy Question:
What's the difference between a junction and an array containing all the possible values of the junction? Other than how they are used, of course. So, on that train of thought, would this make sense:
if $x == @x.any {...} if $x == @x.none {...}
If this is the case, then this entire discussion collapses into how to best convert arrays into junctions and junctions into arrays. Perl's existing abilities to edit arrays should be more than sufficient for editing junctions.
-- Rod Adams