+2012-04-26 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * functions.texi (Simple Lambda, Argument List):
+ * eval.texi (Function Indirection): Avoid deprecated form.
+
2012-04-26 Glenn Morris <rgm@gnu.org>
* book-spine.texi, elisp.texi, vol1.texi, vol2.texi:
Executing the function itself evaluates its body; this does involve
symbol function indirection when calling @code{erste}.
+ This form is rarely used and is now deprecated. Instead, you should write it
+as:
+
+@smallexample
+@group
+(funcall (lambda (arg) (erste arg))
+ '(1 2 3))
+@end group
+@end smallexample
+or just
+@smallexample
+@group
+(let ((arg '(1 2 3))) (erste arg))
+@end group
+@end smallexample
+
The built-in function @code{indirect-function} provides an easy way to
perform symbol function indirection explicitly.
@end example
@noindent
-We can call this function by writing it as the @sc{car} of an
-expression, like this:
+We can call this function by passing it to @code{funcall}, like this:
@example
@group
-((lambda (a b c) (+ a b c))
- 1 2 3)
+(funcall (lambda (a b c) (+ a b c))
+ 1 2 3)
@end group
@end example
@example
@group
-((lambda (a b c) (+ a b c))
- 1 (* 2 3) (- 5 4))
+(funcall (lambda (a b c) (+ a b c))
+ 1 (* 2 3) (- 5 4))
@end group
@end example
Here are some examples of argument lists and proper calls:
@smallexample
-((lambda (n) (1+ n)) ; @r{One required:}
- 1) ; @r{requires exactly one argument.}
+(funcall (lambda (n) (1+ n)) ; @r{One required:}
+ 1) ; @r{requires exactly one argument.}
@result{} 2
-((lambda (n &optional n1) ; @r{One required and one optional:}
- (if n1 (+ n n1) (1+ n))) ; @r{1 or 2 arguments.}
- 1 2)
+(funcall (lambda (n &optional n1) ; @r{One required and one optional:}
+ (if n1 (+ n n1) (1+ n))) ; @r{1 or 2 arguments.}
+ 1 2)
@result{} 3
-((lambda (n &rest ns) ; @r{One required and one rest:}
- (+ n (apply '+ ns))) ; @r{1 or more arguments.}
- 1 2 3 4 5)
+(funcall (lambda (n &rest ns) ; @r{One required and one rest:}
+ (+ n (apply '+ ns))) ; @r{1 or more arguments.}
+ 1 2 3 4 5)
@result{} 15
@end smallexample
*** New function `special-variable-p' to check whether a variable is
declared as dynamically bound.
+*** The form ((lambda ...) ...) is deprecated.
+
** An Emacs Lisp testing tool is now included.
Emacs Lisp developers can use this tool to write automated tests for
their code. See the ERT info manual for details.