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

Reply via email to