>>>>> "DC" == Damian Conway <[EMAIL PROTECTED]> writes:

DC> I'm not sure how this would affect the proposal. If an item in the
DC> list being reduced is undef, it appears in the reduction
DC> subroutines arg list as undef.  The reduction subroutine can then
DC> handle it (or not) as it chooses.

DC> For example, to short-circuit if the reduction ever becomes undef:

DC>     $sum = { defined $_[0] or last; $_[0]+$_[1] } 0, @numbers;

Actually, it would be easier to do in reduce, the undefs should
simply be ignored.

Otherwise having the user code it, becomes

        { defined $_[0] && defined $_[1] ? $_[0] + $_[1] 
                : defined $[0] ? $_[0] : $_[1] }

Pretty ugly.

And for the N case, it gets even uglier. So reduce should be able
to supply the next N-1 defined() values.

<chaim>
-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to