> -----Original Message----- > From: Damian Conway [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 31, 2005 11:14 PM > To: perl6-language@perl.org > Subject: Re: reduce metaoperator on an empty list > > Juerd asked: > > > >> 2+ args: interpolate specified operator > >> 1 arg: return that arg > >> 0 args: fail (i.e. thrown or unthrown exception depending on use > fatal) > > > > Following this logic, does join(" ", @foo) with [EMAIL PROTECTED] being 0 > > fail too? > > No. It returns empty string. You could think of C<join> as being > implemented: > > sub join (Str $sep, [EMAIL PROTECTED]) { reduce { $^a ~ $sep ~ $^b } "", > @list } > > Just as C<sum> is probably implemented: > > sub sum ([EMAIL PROTECTED]) { [+] 0, @list } >
If this were the case, then join '~', 'a', 'b', 'c' would equal '~a~b~c' instead of 'a~b~c' Joe Gottman