TSa wrote: > HaloO, > > Sam Vilain wrote: > >> perl -MPerl6::Junction=one,all -le '@foo=qw(1 2 3 4); print "yes" if >> (all(@foo) eq one(@foo))' >> yes >> > > But does it fail for duplicates? I guess not because junctions > eliminate duplicates and you end up testing unique values as > above. E.g. all(1,1,2) == one(1,1,2) might actually give the > same result as all(1,2) == one(1,2). >
Neither Pugs nor Perl6::Junction behaves like this. pugs> for ([1,2,3], [1,1,2,3]) -> $x { my @x = @$x; my $all_unique = ( all(@x) == one(@x) ); print "{ $x.join(",") } became ", $all_unique; say " (which is { $all_unique ?? "TRUE" !! "FALSE" })" } 1,2,3 became all(VJunc one(VBool True)) (which is TRUE) 1,1,2,3 became all(VJunc one(VBool False,VBool True),VJunc one()) (which is FALSE) Sam.