On Mon, 30 Mar 2009, Jon Lang wrote:
> Here's another useful one:
> any($x) eqv all($x) eqv one($x) eqv $x
> none($x) !eqv $x
> That is, applying any, all, or one to a one-item list produces the
> equivalent to a single item. For an empty list: any() eqv all() eqv
> (). But what about one() and none()?
It seems to me that "one" is out of step with the "scalarness" of junctions;
it implies that you have to look for two things, firstly that there is some
value in the eigenstates that satisfies whatever condition, and secondly
that every other value does not.
I suspect that the confusion arises because the original intention would
have been to have something along the lines of:
none === !any
something === !all
except that "one" doesn't fit the bill as "something".
But back to the original question, since "none" is just a funny spelling for
"!any", their mutual combination can be flattened accordingly:
none($a, any($b, $c)) == none($a, $b, $c)
And (given a suitable interpretation of a monadic "none"):
all($a, none($b, $c)) == all($a, none($b), none($c))
Or in general, it doesn't matter how many times you mention a simple
scalar in an expression, it always has the same value, so that
( $a <= $x <= $b ) == ( $a <= $x && $x <= $b )
always holds true.
However I suspect that if $x = any(-1, +1) this may no longer be the case.
This would certainly be false:
( $a <= any(-1,+1) <= $b ) == ( $a <= any(-1,+1) && any(-1,+1) <= $b )
Consider if $a and $b are both 0 ...
For this to work it seems that the auto-threading logically must reach back
to the point where the junction is created, or at least to be tied to the
identity of the junction in some way. Which latter would imply that
any($a, $b) !== any($a, $b)
There must be a logical way out, but how? Any other comments?
$x = any(-1,+1);
$x < $x and die;
# must not happen (same eigenstate must
# be used on both sides of '<' ?)
$x < $x.eigenstates.any() or die;
# matches for "-1 < +1"