> 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.
$def_sum = reduce { $_[0]+$_[1] } grep {defined} @numbers;
Damian
- RFC 76 (v1) Builtin: reduce Perl6 RFC Librarian
- Re: RFC 76 (v1) Builtin: reduce Chaim Frenkel
- Re: RFC 76 (v1) Builtin: reduce Bart Lateur
- Re: RFC 76 (v1) Builtin: reduce Damian Conway
- Re: RFC 76 (v1) Builtin: reduce Chaim Frenkel
- Re: RFC 76 (v1) Builtin: reduce Randal L. Schwartz
- Re: RFC 76 (v1) Builtin: reduce Damian Conway
- Re: RFC 76 (v1) Builtin: reduce Chaim Frenkel
- Re: RFC 76 (v1) Builtin: reduce Damian Conway
- Re: RFC 76 (v1) Builtin: reduce Dan Sugalski
- Re: RFC 76 (v1) Builtin: reduce Ariel Scolnicov
- Re: RFC 76 (v1) Builtin: reduce Chaim Frenkel
- Re: RFC 76 (v1) Builtin: reduce Ariel Scolnicov
- Re: RFC 76 (v1) Builtin: reduce Chaim Frenkel
- Re: RFC 76 (v1) Builtin: reduce Jeremy Howard
- Re: RFC 76 (v1) Builtin: reduce Ariel Scolnicov
- Re: RFC 76 (v1) Builtin: red... Bart Lateur
