Re: cross operator and empty list

2008-04-16 Thread TSa
HaloO, Larry Wall wrote: Then [X]() also is ()? How about (0,1) X ([]) === (0,1)? No, that's (0,[]), (1,[1]). [] *doesn't* flatten in list context. I guess you meant (0,[]), (1,[]). And you didn't answer what [X]() returns. Following your arguments this would be undef. I am genuinely

Re: cross operator and empty list

2008-04-14 Thread Xavier Noria
On Apr 12, 2008, at 17:37 , Moritz Lenz wrote: [EMAIL PROTECTED] wrote: Technically the Cartesian cross operator doesn't have an identity value. It has. The set which contains only the emty set, or in perl terms ([]); If (a, b) denotes an ordered pair you get {0, 1} X {{}} = {(0, {}),

RE: cross operator and empty list

2008-04-14 Thread Miller, Hugh
-Original Message- From: Mark A. Biggar [mailto:[EMAIL PROTECTED] Sent: Sunday, April 13, 2008 11:22 PM To: Miller, Hugh Cc: Moritz Lenz; p6l Subject: Re: cross operator and empty list Miller, Hugh wrote: From: Moritz Lenz [mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote

Re: cross operator and empty list

2008-04-14 Thread Xavier Noria
On Apr 14, 2008, at 12:05 , TSa wrote: HaloO, Xavier Noria wrote: {0, 1} X {{}} = {(0, {}), (1, {})} which, you see, is different from {0, 1}. They have different elements. The fact that there's a clear mapping that sort of identifies them has nothing to do with set equality. But X is

Re: cross operator and empty list

2008-04-14 Thread TSa
HaloO, Xavier Noria wrote: {0, 1} X {{}} = {(0, {}), (1, {})} which, you see, is different from {0, 1}. They have different elements. The fact that there's a clear mapping that sort of identifies them has nothing to do with set equality. But X is cooperating with , in Perl 6: (0,1) X

Re: cross operator and empty list

2008-04-14 Thread Larry Wall
On Mon, Apr 14, 2008 at 12:05:15PM +0200, TSa wrote: But X is cooperating with , in Perl 6: (0,1) X (()) === ((0,()),(1,())) === (0,1) That is, X strips the outer list and comma concatenates the inner empty list away. No, the inner () is also in list context, and () in list context always

Re: cross operator and empty list

2008-04-14 Thread TSa
HaloO, Larry Wall wrote: No, the inner () is also in list context, and () in list context always just disappears. And 0,1 X () is going to be (). Perl 6's infix:X is defined over lists, not sets. If you want to overload X for set types, you may. Then [X]() also is ()? How about (0,1) X

Re: cross operator and empty list

2008-04-14 Thread TSa
HaloO, I wrote: Then [X]() also is ()? How about (0,1) X ([]) === (0,1)? The original question was sort of about how to write a list that has .elems == 1 but no content. Other ideas are: [[]] and @@() with the latter not very likely because it implies any multidimensional array somehow having

Re: cross operator and empty list

2008-04-14 Thread Larry Wall
On Mon, Apr 14, 2008 at 06:28:06PM +0200, TSa wrote: HaloO, Larry Wall wrote: No, the inner () is also in list context, and () in list context always just disappears. And 0,1 X () is going to be (). Perl 6's infix:X is defined over lists, not sets. If you want to overload X for set

Re: cross operator and empty list

2008-04-14 Thread Mark J. Reed
On Mon, Apr 14, 2008 at 06:28:06PM +0200, TSa wrote: The original question was sort of about how to write a list that has .elems == 1 but no content. Wouldn't that just be [[]] ? Mark J. Reed [EMAIL PROTECTED]

Re: cross operator and empty list

2008-04-14 Thread Doug McNutt
At 09:58 -0700 4/14/08, Larry Wall wrote: By the way, you don't need to put parens around the arguments to X. It takes a list on either side. We made it tall so that it would stand out visually anyway: $a,$b,$c X $x,$y,$z How long before some engineer or 3D graphic artist gets really

Re: cross operator and empty list

2008-04-14 Thread Larry Wall
On Mon, Apr 14, 2008 at 11:47:04AM -0600, Doug McNutt wrote: : At 09:58 -0700 4/14/08, Larry Wall wrote: : By the way, you don't need to put parens around the arguments to X. It takes a list on either side. We made it tall so that it would stand out visually anyway: : : $a,$b,$c X $x,$y,$z

Re: cross operator and empty list

2008-04-14 Thread John M. Dlugosz
Doug McNutt douglist-at-macnauchtan.com |Perl 6| wrote: At 09:58 -0700 4/14/08, Larry Wall wrote: By the way, you don't need to put parens around the arguments to X. It takes a list on either side. We made it tall so that it would stand out visually anyway: $a,$b,$c X $x,$y,$z

RE: cross operator and empty list

2008-04-13 Thread Miller, Hugh
-Original Message- From: Moritz Lenz [mailto:[EMAIL PROTECTED] Sent: Saturday, April 12, 2008 10:37 AM To: [EMAIL PROTECTED] Cc: p6l Subject: Re: cross operator and empty list [EMAIL PROTECTED] wrote: Technically the Cartesian cross operator doesn't have an identity value. It has

Re: cross operator and empty list

2008-04-13 Thread Mark A. Biggar
Miller, Hugh wrote: From: Moritz Lenz [mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Technically the Cartesian cross operator doesn't have an identity value. It has. The set which contains only the emty set, or in perl terms ([]); Or am I missing something? Should be a (any) 1 point set

Re: cross operator and empty list

2008-04-12 Thread Moritz Lenz
[EMAIL PROTECTED] wrote: Technically the Cartesian cross operator doesn't have an identity value. It has. The set which contains only the emty set, or in perl terms ([]); Or am I missing something? Cheers, Moritz -- Moritz Lenz http://moritz.faui2k3.org/ | http://perl-6.de/ signature.asc

Re: cross operator and empty list

2008-04-07 Thread TSa
HaloO, Larry Wall wrote: (@a X @b X @c).elems == @a.elems * @b.elems * @c.elems Sorry, I was aiming at defining a neutral element of the X operator. In cartesian products of sets this is achieved by having a set that contains as sole member the empty tuple. So how would that be written?

Re: cross operator and empty list

2008-04-07 Thread Adriano Ferreira
On Mon, Apr 7, 2008 at 4:50 AM, TSa [EMAIL PROTECTED] wrote: HaloO, Larry Wall wrote: (@a X @b X @c).elems == @a.elems * @b.elems * @c.elems Sorry, I was aiming at defining a neutral element of the X operator. A neutral element for the cross operator seems weird if that is to be

Re: cross operator and empty list

2008-04-07 Thread Darren Duncan
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

Re: cross operator and empty list

2008-04-07 Thread mark . a . biggar
Technically the Cartesian cross operator doesn't have an identity value. There is no set X such that A x X = A. Now any singleton set gives a result that is naturally isomorphic to the original set, I.e, there is a obvious bijection between the two sets, but they are not equal sets. -- Mark

Re: cross operator and empty list

2008-04-07 Thread Darren Duncan
[EMAIL PROTECTED] wrote: Technically the Cartesian cross operator doesn't have an identity value. There is no set X such that A x X = A. Now any singleton set gives a result that is naturally isomorphic to the original set, I.e, there is a obvious bijection between the two sets, but they are

cross operator and empty list

2008-04-04 Thread TSa
HaloO, why is (1,2,3) X () defined to be the empty list and not (1,2,3) as is the case with the cartesian product of sets which X basically is with preserved order. Regards, TSa. -- The Angel of Geometry and the Devil of Algebra fight for the soul of any mathematical being. -- Attributed to

Re: cross operator and empty list

2008-04-04 Thread mark . a . biggar
Cartesain product with the empty set is empty. A x B is the set of all pairs (a,b) where a is in A and b is in B. If either is empty then there are no such pairs and the result is also empty. -- Mark Biggar [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] -- Original message

Re: cross operator and empty list

2008-04-04 Thread Larry Wall
On Fri, Apr 04, 2008 at 06:51:20PM +0200, TSa wrote: HaloO, why is (1,2,3) X () defined to be the empty list and not (1,2,3) as is the case with the cartesian product of sets which X basically is with preserved order. (@a X @b X @c).elems == @a.elems * @b.elems * @c.elems Larry

Re: cross operator and empty list

2008-04-04 Thread Mark J. Reed
Cartesian product of anything with the empty set is empty. Which is why SQL has outer joins. On 4/4/08, TSa [EMAIL PROTECTED] wrote: HaloO, why is (1,2,3) X () defined to be the empty list and not (1,2,3) as is the case with the cartesian product of sets which X basically is with preserved