Darren Duncan wrote:
Larry Wall wrote:
It seems simpler to say that one() produces bags rather than sets.
If we don't make other modifications to the language then this would
mean that a Junction is defined over a union type, "Set|Bag with
additional behaviors", depending on what operator constructed it.
Now maybe that's fine.
Or alternately, why not just redefine a Junction for consistency to say
it is a "Bag with additional behaviors" rather than a "Set with
additional behaviors"? Would doing this break anything? Do any intended
uses of a Junction specifically versus a plain Set|Bag involve asking
how many instances of a value there are, or asking how many distinct
values or value instances are in the Junction? Aside from the 3
answers: exactly none, exactly one, one or more?
The meaning of any() and all() do not change if the collection is
allowed to be a Bag instead of a Set.
There are two reasonable meanings for one(), either duplicates collapse
done to single members of the collection or duplicates cancel (or are
ignored, same thing). The later interpretation would mean that
one(1,2,3,3) is the same as one(1,2), but constants aren't the
interesting case, one(@a) is. I suppose we could define a
:uniq(true|false) adverb to modify the meaning of one() so we could
have both interpretations.