Okay, then for reduce &avg $identity, @list What should $identity be? <chaim> >>>>> "AS" == Ariel Scolnicov <[EMAIL PROTECTED]> writes: AS> Think of the first element of the list as different from the rest -- AS> it is the initial value to reduce from (for + and *, you'll usually AS> pick an appropriate identity element). By writing AS> @sum = reduce __+__ 0, @numbers AS> you deal elegantly with both cases. AS> NOTE: I find this trick very elegant. I wish it were my trick, AS> instead of Damian's... -- Chaim Frenkel Nonlinear Knowledge, Inc. [EMAIL PROTECTED] +1-718-236-0183
- 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: reduce Bart Lateur
- Re: RFC 76 (v1) Builtin: redu... Graham Barr
- Re: RFC 76 (v1) Builtin: redu... John Porter
- Re: RFC 76 (v1) Builtin: reduce Graham Barr
- Re: RFC 76 (v1) Builtin: reduce Chaim Frenkel
- Re: RFC 76 (v1) Builtin: reduce Damian Conway
- Re: RFC 76 (v1) Builtin: reduce Damian Conway
- Re: RFC 76 (v1) Builtin: reduce Damian Conway