[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/doc/lispref/functions.texi,v
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] Changes to emacs/doc/lispref/functions.texi,v |
Date: |
Mon, 20 Oct 2008 10:22:16 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Eli Zaretskii <eliz> 08/10/20 10:22:16
Index: functions.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/doc/lispref/functions.texi,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- functions.texi 19 Oct 2008 14:56:27 -0000 1.13
+++ functions.texi 20 Oct 2008 10:22:16 -0000 1.14
@@ -727,7 +727,7 @@
@cindex partial application of functions
@cindex currying
- Sometimes, it is useful to fix some of the function's arguments at
+ Sometimes it is useful to fix some of the function's arguments at
certain values, and leave the rest of arguments for when the function
is actually called. The act of fixing some of the function's
arguments is called @dfn{partial application} of the address@hidden
@@ -737,7 +737,9 @@
argument.}.
The result is a new function that accepts the rest of
arguments and calls the original function with all the arguments
-combined. Emacs provides a function for partial evaluation:
+combined.
+
+ Here's how to do partial application in Emacs Lisp:
@defun apply-partially func &rest args
This function returns a new function which, when called, will call
@@ -747,14 +749,14 @@
@address@hidden@var{m} < @var{n}}} arguments will produce a new function of
@address@hidden@var{n} - @var{m}}} arguments.
-Here's an example of using @code{apply-partially} to produce a
-function @code{incr}, that will increment its argument by one, based
-on the Emacs Lisp primitive @code{+}:
+Here's an example of using @code{apply-partially} to produce a variant
+of the Emacs Lisp primitive @code{1+}, a function that increments its
+argument by one, based on the primitive @code{+}:
@example
-(fset 'incr (apply-partially '+ 1))
+(fset 'incr-by-one (apply-partially '+ 1))
@group
-(incr 10)
+(incr-by-one 10)
@result{} 11
@end group
@end example