On Thu, Nov 13, 2008 at 02:55:06PM +0100, Leon Timmermans wrote: > On Thu, Nov 13, 2008 at 2:24 PM, TSa <[EMAIL PROTECTED]> wrote: > > Pm wrote: > > > Presumably the values of a one() junction do not collapse in > > > this way, otherwise we could easily lose the fact that > > > a value occurs more than once: > > > > > > my $a = (one(1,2,3) % 2 == 1); > > > > Do I understand your question right, that you want the return > > of == to be false because there is a one(1,0,1) junction?
I expect that $a will become one(True, False, True). $a doesn't collapse to a non-Junction False until it is used in a boolean context. my $a = one(1,2,3) % 2 == 1; --> my $a = one(1%2, 2%2, 3%2) == 1; --> my $a = one(1%2 == 1, 2%2 == 1, 3%2 == 1); --> my $a = one( True, False, True ); > > As Duncan points out junctions are immutable values and as such > > the % autothreads but the resulting values are assembled into > > a new junction according to the general rules, i.e. one(0,1). > > The number of elements in one(1,2,3) is not preserved. > > But of what use would one() if it were to use those semantics? It > would be essentially the same as any(), and it would definitely not > DWIM. I agree that one() with collapsing values isn't dwimmy (or useful), which is part of the reason for my original message. Pm