Em Sáb, 2009-03-28 às 16:17 +1100, Damian Conway escreveu:
> Nested heterogeneous junctions are extremely useful. For example, the
> common factors of two numbers ($x and $y) are the eigenstates of:
>     all( any( factors($x) ), any( factors($y) ) )

I think that's the exact case where we should be using sets instead...

  my $common_factors = factors($x) ∩ factors($y)

Assuming we have...

  multi infix:<∩>(List @a, List @b --> Set) {...}
  multi infix:<∩>(Set @a, Set @b --> Set) {...}
  ... and variants ...

But the semantics of sets are still somewhat blurry... there are some
possibilities:

  1) Sets are in the same level as junctions, but have no collapsing and
     allow you to get its values. The problem is if it autothreads on 
     method calls or not... It also makes $a > $b confuse...

  2) Set ~~ Any, and all the inteligence is made implementing multis, 
     it has the disadvantage that new operators will need to have 
     explicit implementations in order to get Set DWIMmery...

I have been unsure about that, but lately I'm mostly thinking option 2
is the sanest, which means we only get as much DWIMmery as explicitly
implemented (which may or may not be a good idea).

daniel

Reply via email to