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.