Hot answers tagged

5

Use apply when you don't know what the individual arguments are, or how many there are. You can use funcall (or apply) when you do know that. For example, suppose your list of args to apply the function to is the value of variable foo. Then you would use (apply 'some-fun foo). If you know that you're going to apply the function to args 3, toto, and 4, in ...


2

Not exactly. Function buffer-substring requires two arguments. Function - will accept a single argument, but in that case it just returns the negative of that numeric argument. What you want to do is, in effect, apply such functions to a list of arguments. You can use higher-order function apply to do that. What you can do, if you want, is have a macro or ...


2

((lambda ...) ...) is a special case, and IIRC the only such special case. Lots of elisp functions return functions, and apply-partially is no different to any of the others in this regard. source of the function shows that it actually returns a lambda Most functions are (ultimately) lambdas. See C-hig (elisp)What Is a Function for details. C-hig (...


1

Your C-h f is not the standard C-h f (M-x describe-function), describe-function doesn't provide "References ..." information at all. To find the source of apply, use C-h f apply, it will say apply is a built-in function in `src/eval.c'. src/eval.c will be clickable, then click it to go to the source. If you didn't install Emacs from the source code by ...


Only top voted, non community-wiki answers of a minimum length are eligible