Patrick R. Michaud wrote:
Are duplicate values in any/all/none junctions expected to "collapse"
such that each value becomes unique?  For example, should
any(1,2,2,1,2,3,2) internally reduce to the equivalent of any(1, 2, 3)? Or is this something that is left to individual
implementations to decide?

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

Comments and/or pointers to relevant specifications that I've
missed are welcomed.

According to Synopsis 2, under "Immutable types", a Junction is a "Set with additional behaviors". This implies to me a Junction consists just of distinct unordered values. A Junction is not a Bag and it doesn't matter that we lose the fact that a value occurred more than once in the arguments of the Junction constructor. Whether values are considered identical or not and get eliminated depends on what their .WHERE returns. Whether a Perl 6 implementation internally reduces the constructor value list doesn't matter as long as the semantics of using the Junction are as if it had; so eg that reduction could be done lazily, just when the Junction is first used. -- Darren Duncan

Reply via email to