[Top][All Lists]

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

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

From: Eli Zaretskii
Subject: bug#17623: 24.4.50; incorrect example for `apply-partially' in (elisp) `Calling Functions'
Date: Sat, 28 Jun 2014 21:45:22 +0300

> From: Michael Heerdegen <address@hidden>
> Cc: address@hidden
> Date: Sat, 28 Jun 2014 19:53:34 +0200
> There's nothing wrong per see in the current text, but it sounds as if
> `apply-partially` would somehow analyze the argument list of its first
> argument.

Where does it say that?  It says the result is a new function that
will call the original with all the arguments combined.  There's
nothing about analysis in that text.

> 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

then it directly follows the part we were talking about.

reply via email to

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