TSa wrote:
> role Set[::T = Item] does Collection[T] where { > all(.members) =:= one(.members); > }; Nice usage of junctions!
But buggy - one means *exactly* one. So for an array of more than 1 element, all(@array) never equals one(@array) - if they're all the same, it's more than 1, otherwise it's 0.
all(.members) =:= any(.members) would also not work, as it will try to match each member with some other or same member of the array. It will always return true, in other words, as each element of the array is equal to itself.
This leaves all(.members) =:= .members[0], possibly extra with non-emptiness test.
Miro