Rod Adams wrote:

Okay, so we've established that:

$x = any(3,4,5);
@l = $x.values.sort;

Leaves us with @l == (3,4,5), and that makes a fair amount of sense.


What do the following evaluate to:

@l1 = all(3,4,5).values.sort;

Same.

@l2 = one(3,4,5).values.sort;

Same.

@l3 = none(3,4,5).values.sort;

Same.


@l4 = any(all(1,2),all(3,4)).values.sort;

= (all(1,2),all(3,4)).sort

      = (all(1,2),all(3,4))


If C<.values> doesn't it cut it for these cases, what other forms of introspection are we going to allow on junctions, to determine what they are?

.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".



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).



any($a, $a) == $a

True.


any($a,$a,$b) == any($a,$b)

True.


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

True.


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

True.


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.


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

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


none($a, $a) == undef

True.


none($a,$a,$b) == none($a,$b)

True.


none(none($a,$b),none($c,$d)) == none($a,$b,$c,$d)

True.



one($a, $a) == false

True.


one($a,$a,$b) == ($a == $b ?? undef :: $b)

True.


Damian

Reply via email to