TSa wrote: > Ahh, I see. Thanks for the hint. It's actually comma that builds lists. > So we could go with () for undef and require (1,) and (,) for the single > element and empty list respectively. But then +(1,2,3,()) == 4.
Actually, note that both infix:<,> and circumfix:<[ ]> can be used to build lists; so [1] and [] can be used to construct single-element and empty lists, respectively. >> On the other hand, there's just that sort of double discontinuity in >> English pluralization, where we say "2 (or more) items", then "1 >> item", but then "no items". So perhaps it's justifiable in Perl6 as >> well. > > I would also opt for () meaning empty list as a *defined* value. Pairs > that shall receive the empty list as value could be abbreviated from > :foo(()) to :foo(,). As long as the distinction between Array and List > doesn't matter one can also say :foo[], of course. Personally, I'd like to see '()' capture the concept of "nothing" in the same way that '*' captures the concept of "whatever". There _may_ even be justification for differentiating between this and "something that is undefined" (which 'undef' covers). Or not; I'm not sure of the intricacies of this. One possibility might be that '1, 2, undef' results in a three-item list '[1, 2, undef]', whereas '1, 2, ()' results in a two-item list '[1, 2]' - but that may be a can of worms that we don't want to open. -- Jonathan "Dataweaver" Lang