>>>>> "DC" == Damian Conway <[EMAIL PROTECTED]> writes: >> And for the N case, it gets even uglier. So reduce should be able >> to supply the next N-1 defined() values. DC> $def_sum = reduce { $_[0]+$_[1] } grep {defined} @numbers; Fine. Even better if the optimizer could recognize the idiom and use the reduce_no_undefs version. Any problems if the reduce_no_undefs version were used for the tristate pragma? I'm not sure it should because we would be making the reduce operator too smart. But I can see the issue that a single undef would turn the results to undef. While we are here, can reduce itself generate an average? I.e. something cuter than: $avg = reduce { $_[0] + $_[1] } @numbers / @numbers; <chaim> -- Chaim Frenkel Nonlinear Knowledge, Inc. [EMAIL PROTECTED] +1-718-236-0183
- 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
- Re: RFC 76 (v1) Builtin:... Graham Barr