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 types, you may.
>
> Then [X]() also is ()? How about (0,1) X ([]) === (0,1)?

No, that's (0,[]), (1,[1]).  [] *doesn't* flatten in list context.

> The original question was sort of about how to write a list
> that has .elems == 1 but "no" content.

I am genuinely curious as to why anyone who is not a mathematician
would want this?  Rather than bend the current practical meanings of ()
and [], we possibly have the symbolic concept expressible as none(*).
We don't define junctions as special in lists, which means it would
be up to the implementation of infix:<X> to do something with it.

But let me reiterate that lists are just lists, not sets.  In fact,
they're closer to bags than sets.  But lists are as much about
ordering as they are about membership.  Please don't take the use
of mathematical language to metaphorically describe the behavior of
infix:<X> as an attempt to confuse you.  :)

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

Larry

Reply via email to