> In any case, the preferred option should be to provide a default value: > > $sum = reduce ^_+^_, 0, @values; > > which is always cleaner *and* shorter. :-) Ummm...Maybe I'm missing something, but how does reduce() know the difference between $sum = reduce ^_+^_, 0, @values; unshift @values, 0; $sum = reduce ^_+^_, @values; $sum = reduce ^_+^_, 0, 1, 2, 3, 4, 5; Is this just a prototyping issue? And if so, any reason not to make 0 the default value by default? I'm still uneasy about the throwing exception thing, in case you can't tell... -Nate
- Re: RFC 76 (v2) Builtin: reduce Nathan Wiger
- Re: RFC 76 (v2) Builtin: reduce Peter Scott
- Re: RFC 76 (v2) Builtin: reduce Tom Christiansen
- Re: RFC 76 (v2) Builtin: reduce Damien Neil
- Re: RFC 76 (v2) Builtin: reduce John Porter
- Re: RFC 76 (v2) Builtin: reduce Glenn Linderman
- Re: RFC 76 (v2) Builtin: reduce John Porter
- Re: RFC 76 (v2) Builtin: reduce Damian Conway
- Re: RFC 76 (v2) Builtin: reduce Tom Christiansen
- Re: RFC 76 (v2) Builtin: reduce Damian Conway
- Re: RFC 76 (v2) Builtin: reduce Nathan Wiger
- Re: RFC 76 (v2) Builtin: reduce Tom Christiansen
- Re: RFC 76 (v2) Builtin: reduce Damian Conway