bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37400: Patch for bug in cl-reduce: function called with no arguments


From: Noam Postavsky
Subject: bug#37400: Patch for bug in cl-reduce: function called with no arguments when list is empty
Date: Fri, 13 Sep 2019 11:18:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.92 (windows-nt)

AdriĆ  Garriga <adria.garriga@gmail.com> writes:

> +(ert-deftest cl-seq-reduce ()
> +  (let ((bad-add (lambda (x y) (+ x y))))
> +    (should-not (cl-reduce bad-add nil))

Actually, I think it's a docstring bug.  The Common Lisp Hyperspec says:

    If the subsequence is empty and no initial-value is given, then the
    function is called with zero arguments, and reduce returns whatever
    function does. This is the only case where the function is called
    with other than two arguments.

It looks like Emacs' current implementation is correct, but the
docstring doesn't explain it accurately.

https://www.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Body/fun_reduce.html





reply via email to

[Prev in Thread] Current Thread [Next in Thread]