Perl6 RFC Librarian <[EMAIL PROTECTED]> (but actually it was Damian
Conway) writes:
> If the original list has no elements, C<reduce> immediately returns C<undef>.
I like everything except this part. Reducing an empty list should be
an error.
Returning undef (or anything else, really) breaks the algebraic
equivalence that
f((reduce \&f, LIST), $x) eq (reduce \&F, LIST, $x)
Since this is the single most important property of reduce (indeed, it
is the *only* property of reduce), I don't see what we get by breaking
it.
Also, the RFC should specify that the function is always evaluated in
a scalar context (for things to make sense).
--
Ariel Scolnicov |"GCAAGAATTGAACTGTAG" | [EMAIL PROTECTED]
Compugen Ltd. |Tel: +972-2-6795059 (Jerusalem) \ We recycle all our Hz
72 Pinhas Rosen St. |Tel: +972-3-7658514 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555 http://3w.compugen.co.il/~ariels
- 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
- Re: RFC 76 (v1) Builtin:... John Porter
- Re: RFC 76 (v1) Builtin: reduce Graham Barr
- Re: RFC 76 (v1) Builtin: red... Chaim Frenkel
