At 4:08 PM +0200 10/10/06, TSa wrote:
HaloO,

Darren Duncan wrote:
Within a system that already has an underlying set-like type, the Junction in this case, a test for uniqueness is (pardon any spelling):

  all(@items).elements.size === @items.size

The all() will strip any duplicates, so if the number of elements in all(@items) is the same as @items, then @items has no duplicates.

OK, but you are not using the 'set with additional behavior' of
junctions. How would that be spelled with a pure set?

   set(@items).elements.size === @items.size

perhaps? This would nicely blend with the junction forms.

Yes, that is exactly how it would be spelled with a pure set. In fact, your example is the more normal one, in that simply turning a collection into a set removes duplicates. I used all() in my example because that is the Junction equivalent of making a set that contains all distinct members of @items. -- Darren Duncan

Reply via email to