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

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

bug#17623: closed (24.4.50; incorrect example for `apply-partially' in (


From: GNU bug Tracking System
Subject: bug#17623: closed (24.4.50; incorrect example for `apply-partially' in (elisp) `Calling Functions')
Date: Sat, 23 Oct 2021 05:26:03 +0000

Your message dated Fri, 22 Oct 2021 22:24:55 -0700
with message-id 
<CADwFkmncQnnAvWfFtpvpRSufCcvow8gReNhwHtLsVP7_9ztYkg@mail.gmail.com>
and subject line Re: bug#17623: 24.4.50; incorrect example for 
`apply-partially' in (elisp) `Calling Functions'
has caused the debbugs.gnu.org bug report #17623,
regarding 24.4.50; incorrect example for `apply-partially' in (elisp) `Calling 
Functions'
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
17623: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17623
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 24.4.50; incorrect example for `apply-partially' in (elisp) `Calling Functions' Date: Wed, 28 May 2014 16:53:35 -0700 (PDT)
The text states incorrectly that the example defines an equivalent of
built-in function `1+', but it does not.  The function defined in the
example is equivalent to this one, which is not equivalent to `1+':

(defun 1+-sum (&rest args)
 "Return one more than the sum of the args."
 (1+ (apply #'+ args)))

This function accepts any number of args, including zero.
`1+' requires a single arg.

As it stands, this example is liable to confuse more than help.

In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
 of 2014-05-25 on ODIEONE
Bzr revision: 117153 tsdh@gnu.org-20140525174054-vzeh4zeg00a1ley8
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/snapshot/trunk
 --enable-checking=yes,glyphs 'CFLAGS=-O0 -g3'
 LDFLAGS=-Lc:/Devel/emacs/lib 'CPPFLAGS=-DGC_MCHECK=1
 -Ic:/Devel/emacs/include''



--- End Message ---
--- Begin Message --- Subject: Re: bug#17623: 24.4.50; incorrect example for `apply-partially' in (elisp) `Calling Functions' Date: Fri, 22 Oct 2021 22:24:55 -0700 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Eli Zaretskii <eliz@gnu.org> writes:

>> Say that
>>
>>   (apply-partially f arg_1 ... arg_n)
>>
>> is equivalent to
>>
>>   (lambda (&rest args) (apply f arg_1 ... arg_n args))
>
> Sorry, I don't see how this is an improvement.
>
> Accidentally, the current text is a bit different from what you cited:
>
>    -- Function: apply-partially func &rest args
>        This function returns a new function which, when called, will call
>        FUNC with the list of arguments composed from ARGS and additional
>        arguments specified at the time of the call.  If FUNC accepts N
>        arguments, then a call to `apply-partially' with `M < N' arguments
>        will produce a new function of `N - M' arguments.
>
>> And I think that the paragraph about `apply-partially` should be merged
>> into the later text talking about functionals, because the main use case
>> of `apply-partially` is to construct anonymous functions for usage as
>> argument to some other function.
>
> If you mean this:
>
>      It is common for Lisp functions to accept functions as arguments or
>   find them in data structures (especially in hook variables and property
>   lists) and call them using `funcall' or `apply'.  Functions that accept
>   function arguments are often called "functionals".
>
>      Sometimes, when you call a functional, it is useful to supply a no-op
>   function as the argument.  Here are two different kinds of no-op
>   function:
>
> then it directly follows the part we were talking about.

There was a discussion here about how to improve the 'apply-partially'
documentation, but it didn't yield any concrete suggestions for
improvements.  I read the text we have now, and I find it clear with
regards to the questions raised in this thread, so I'm closing this bug
report.

If this conclusion is incorrect and this is still an issue, please reply
to this email (use "Reply to all" in your email client) and we might
reconsider.  We are more likely to reconsider if such a request comes
with a concrete suggestion for how to improve this text, preferably in
the form of a patch.

Thanks.


--- End Message ---

reply via email to

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