Richard Hainsworth wrote:
Thinking about Jon Lang's -1|+1 example in another way, I wondered about simultaneous conditions.

Consider

$x = any (1,2,5,6)

How do we compose a conditional that asks if any of this set of eigenstates are simultaneously both > 2 and < 5?
Clearly the desired answer for $x is False, but

my $x = any(1,2,5,6); say ?( 2 < $x < 5); # true

Is there some combination of any/all that will achieve this?

Here it would seem that we would want to have some sieving, so that eigenstates that are true for one test can be given to another test.


One answer is to use "grep":

  $x = any (1,2,5,6);
  say ?( (2^..^5).grep: { $_ == $x } ); # "False"


This isn't, of course, quite what you asked for, because the semantics of relops are continuous. So you'd want something like:

  $x = any (1,2, 2.5, 5,6);
  say ?( (2^..^5 :real).grep: { $_ == $x } ); # "False"

(or whatever the syntax for a continuous range is). That might take a while to complete, hence my desire for an analytic grep



That said, the semantics of a chained relop really should work correctly for this. If you only reference a junction once in an expression, then it should behave as such: {a<b<c} !=== {a<b && b<c}.

Reply via email to