Em Sex, 2009-03-27 às 13:36 +0300, Richard Hainsworth escreveu:
> On #perl6, rouso, masak and moritz_ explained that I am incorrectly 
> thinking about junctions as sets and that for this task I should be 
> using another perl idiom, namely lists.

Sorry for not taking each individual point on your mail, but I think
this basically narrows down to the fact that we need some more
definitions of what kinds of things we would do with sets.

The thing is that junctions are so cool that people like to use it for
more things than it's really usefull (overseeing that junctions are too
much powerfull for that uses, meaning it will lead to unexpected
behaviors at some point).

So I get that we do need some cool support for sets as well, I mean...
no collapsing, no autothreading... but maybe some specific behaviors...

taking the blackjack example...

# using the set function as illustration only...
my @hand = set(1,11),3,set(1,11);
my $sum = [+] @hand;

This operation could use some magic so $sum could become

set(5,15,25)

Where it doesn't autothread, nor collapses... but it still provides the
DWIMmery people like so much in junctions...

So... which magic happened here?

1 - multi infix:<+>(Set $set, Num $a)
This would return another set, with each value of $set summed with $a.

2 - multi infix:<+>(Set $a, Set $b)
This would return another set, with $a.values X+ $b.values, already
removing duplicated values, as expected from a set.

So... what do you think?

daniel

Reply via email to