On Tue, Sep 19, 2000 at 03:23:30PM -0600, Tom Christiansen wrote:
> >> If the original list has no elements, C<reduce> immediately throws an
> >> exception.
>
> >What do you mean by exception, die ? No other builtin dies like that at
> >runtime.
>
> Well, more can trigger run-time exceptions than people usually notice,
> but I don't know of one that does so on an empty list.
True, I guess my mind was in a mode thinking of list operators map
grep etc...
I guess the question is should an empty list be considered an inappropriate
argument. I should think there are times that people may want reduce { ... } @array
to return undef if @array is empty and others may want an exception.
But then again the same really goes for passing too few arguments to call
the block at least once. The text states that it will return the first element
if it is only passed one element. But what does it do if the block
is a curried function of three arguments, but the list only contains two ?
Graham.
- RFC 76 (v2) Builtin: reduce Perl6 RFC Librarian
- Re: RFC 76 (v2) Builtin: reduce Jonathan Scott Duff
- Re: RFC 76 (v2) Builtin: reduce iain truskett
- Re: RFC 76 (v2) Builtin: reduce Jonathan Scott Duff
- Re: RFC 76 (v2) Builtin: reduce iain truskett
- Re: RFC 76 (v2) Builtin: reduce Jonathan Scott Duff
- Re: RFC 76 (v2) Builtin: reduce Damian Conway
- Re: RFC 76 (v2) Builtin: reduce iain truskett
- Re: RFC 76 (v2) Builtin: reduce Graham Barr
- Re: RFC 76 (v2) Builtin: reduce Tom Christiansen
- Re: RFC 76 (v2) Builtin: reduce Graham Barr
- Re: RFC 76 (v2) Builtin: reduce John Porter
- Re: RFC 76 (v2) Builtin: reduce Damian Conway
- Re: RFC 76 (v2) Builtin: reduce Damian Conway
- Re: RFC 76 (v2) Builtin: reduce Graham Barr
- Re: RFC 76 (v2) Builtin: reduce iain truskett
- Re: RFC 76 (v2) Builtin: reduce John Porter
- Re: RFC 76 (v2) Builtin: reduce Nathan Wiger
- Re: RFC 76 (v2) Builtin: reduce Tom Christiansen
- Re: RFC 76 (v2) Builtin: reduce Nathan Wiger
- Re: RFC 76 (v2) Builtin: reduce Randal L. Schwartz
