Damian Conway wrote:


.values tells you what raw values are inside the junction. The other kind of introspection that's desirable is: "what raw values can *match* this junction". There would probably be a .states method for that.


To see the difference between the two, consider:

my $ideal_partner = all( any(Âtall dark richÂ),
any(Ârich old frailÂ),
any(ÂAustralian richÂ),
);

$ideal_partner.values would return the three distinct values in the junction:

( any(Âtall dark richÂ),
any(Ârich old frailÂ),
any(ÂAustralian richÂ),
);

But $ideal_partner.states would return only those non-junctive values that (smart-)match the junction. Namely, "rich".

One would need a method of determining whether the C<.values> are in an any/all/none/one relationship. Trivial, but necessary. That and C<.values> are likely enough introspection. Leave the C<.state> for CPAN to solve.



On a slightly different topic, do the following equivalences work:


(I will assume in all my answers that $a, $b, $c, $d have different values, except where it doesn't matter either way).

all($a,$a,$b) == all($a,$b)


False. The autothreading makes that:

all( $a==$a, $a==$b, $b==$b, $b==$a)

and they're not (in general) all true.

I knew I was typing this all wrong. Whipping out math symbols, replace the == with â, or identical to.
In other words, I was not asking how C< if all($a,$a,$b) == all($a,$b) {...} > evaluated, but instead if


if all($a,$a,$b) {...}
if all($a,$b) {...}

would both evaluate the same.

And I was making no assumptions about the values of $a .. $d.


all(all($a,$b),any($c,$d)) == all($a,$b,$c,$d)

False. Because all($a,$b) != all($a,$b,$c,$d)

Should have been

all(all($a,$b), all($c,$d)) â all($a,$b,$c,$d)


Sorry for any confusion. It's just a real pain to type chars that are not bound on your keyboard.


As for the undef's, I didn't know what else to call the empty junctive.


-- Rod Adams




Reply via email to