mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-26 19:18:50 +00:00
(Calling Functions): Use defalias' instead of
fset'. Fix wording.
This commit is contained in:
parent
10e187e823
commit
834b54855c
@ -749,14 +749,17 @@ accepts @var{n} arguments, then a call to @code{apply-partially} with
|
|||||||
@w{@code{@var{m} < @var{n}}} arguments will produce a new function of
|
@w{@code{@var{m} < @var{n}}} arguments will produce a new function of
|
||||||
@w{@code{@var{n} - @var{m}}} arguments.
|
@w{@code{@var{n} - @var{m}}} arguments.
|
||||||
|
|
||||||
Here's an example of using @code{apply-partially} to produce a variant
|
Here's how we could define the built-in function @code{1+}, if it
|
||||||
of the Emacs Lisp primitive @code{1+}, a function that increments its
|
didn't exist, using @code{apply-partially} and @code{+}, another
|
||||||
argument by one, based on the primitive @code{+}:
|
built-in function:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(fset 'incr-by-one (apply-partially '+ 1))
|
|
||||||
@group
|
@group
|
||||||
(incr-by-one 10)
|
(defalias '1+ (apply-partially '+ 1)
|
||||||
|
"Increment argument by one.")
|
||||||
|
@end group
|
||||||
|
@group
|
||||||
|
(1+ 10)
|
||||||
@result{} 11
|
@result{} 11
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
Loading…
Reference in New Issue
Block a user