Adriano, I think perhaps what Tsa is trying to get at is the identity value for the X operator, and I believe I know what it is.

In the relational model of data, both the version of the model where tuples have unordered named attributes/elements (which I prefer), and the version where tuples have ordered attributes/elements (which Perl 6 seems to be using in its X operator), the relational cross product operator is analogous to numeric multiplication or logical 'and' in its properties (except that the ordered version isn't commutative).

With respect to relational join being like multiplication, the special values 0 and 1 are represented by the nilary (zero attribute) relation with either 0 or 1 tuples respectively, which in common Perl array-of-hash (or array-of-array) notation for rowsets is

  []

and

  [ {} ] or [ [] ]

respectively; I'll call them R0 and R1 for now. Joining any relation R with R0 gives R0 (or alternately a relation with the same attributes as R but zero tuples; its zero tuples either way), and joining any relation R with R1 gives R.

So R1 is the identity value for cross product, meaning the identity value for X, in Perl 6 would be a one-element array|seq whose element is the empty array|seq. That is,

  [X] ()

equals this:

  ( () )

Larry et al, on a related note, the list of identity values for reduce in S03 should be updated to account for this; [X] wasn't on the list last I looked.

-- Darren Duncan

Reply via email to