]> code.delx.au - gnu-emacs/blobdiff - doc/lispref/functions.texi
(Terminal I/O Encoding): `keyboard-coding-system' and
[gnu-emacs] / doc / lispref / functions.texi
index 4609fc18ceff27346d3db2ab73884bc715809692..5f3995ea0c0c7bcc4644c9088cdcc83ce72533fe 100644 (file)
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001,
-@c   2002, 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+@c   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../../info/functions
 @node Functions, Macros, Variables, Top
@@ -727,7 +727,7 @@ of mapcar}.
 
 @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 function@footnote{
@@ -737,7 +737,9 @@ it can be called as a chain of functions, each one with a single
 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,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{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 how we could define the built-in function @code{1+}, if it
+didn't exist, using @code{apply-partially} and @code{+}, another
+built-in function:
 
 @example
-(fset 'incr (apply-partially '+ 1))
 @group
-(incr 10)
+(defalias '1+ (apply-partially '+ 1)
+  "Increment argument by one.")
+@end group
+@group
+(1+ 10)
      @result{} 11
 @end group
 @end example
@@ -1303,8 +1308,8 @@ byte compiler can check that the calls match the declaration.
 
 @defmac declare-function function file &optional arglist fileonly
 Tell the byte compiler to assume that @var{function} is defined, with
-arguments @var{arglist}, and that the definition should come from
-the file @var{file}.  @var{fileonly} non-nil means only check that
+arguments @var{arglist}, and that the definition should come from the
+file @var{file}.  @var{fileonly} non-@code{nil} means only check that
 @var{file} exists, not that it actually defines @var{function}.
 @end defmac
 
@@ -1414,10 +1419,10 @@ A symbol on the list @code{safe-functions}, so the user says it's safe.
 @item
 A symbol with a non-@code{nil} @code{side-effect-free} property.
 @item
-A symbol with a non-@code{nil} @code{safe-function} property.  Value t
-indicates a function that is safe but has innocuous side effects.
-Other values will someday indicate functions with classes of side
-effects that are not always safe.
+A symbol with a non-@code{nil} @code{safe-function} property.  The
+value @code{t} indicates a function that is safe but has innocuous
+side effects.  Other values will someday indicate functions with
+classes of side effects that are not always safe.
 @end itemize
 
 The @code{side-effect-free} and @code{safe-function} properties are