[DGD] & operato

Mikael Lind mikkelin at gmail.com
Tue Nov 6 10:12:51 CET 2007


On 06/11/2007, Petter Nyström <jimorie at gmail.com> wrote:
>
> This is only true under the assumption that query_users() returns an
> array where no two elements are equal, i.e. is a set. A fair
> assumption to make, granted, but I thought it was worth pointing out
> that the & operator does not guarantee that the the result is a set by
> itself.


I was under the assumption that ({ x, x }) & ({ x }) => ({ x }), not ({ x, x
}). I regret that I cannot attempt to verify that at the moment. If we are
going to be strict, my mental model of the &, |, and ^ operators for arrays
are that they operate on multisets, of which sets are a special case.

Similar set operators in LPC are | (union) and ^ (inverted intersection).
>

Agreed. The - operator (set difference) belongs there as well, though I do
not believe that it applies properly to multisets.

Mikael



More information about the DGD mailing list