summaryrefslogtreecommitdiff
path: root/lispref
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-01-13 21:52:44 +0000
committerRichard M. Stallman <rms@gnu.org>2002-01-13 21:52:44 +0000
commita43aed0a5a1b43348726eec862c6f94ef47c9e11 (patch)
tree658a88d1682d893cde0e18470f11b8a32090bdb8 /lispref
parent4bf1ac4172b32e3cbc8ecc29e2aad327b763870a (diff)
downloademacs-a43aed0a5a1b43348726eec862c6f94ef47c9e11.tar.gz
Restore the quote in the `silly' example.
Fix the double-property examples. Include one with a bare lambda.
Diffstat (limited to 'lispref')
-rw-r--r--lispref/functions.texi16
1 files changed, 14 insertions, 2 deletions
diff --git a/lispref/functions.texi b/lispref/functions.texi
index 9f684593a98..67d68e40a9a 100644
--- a/lispref/functions.texi
+++ b/lispref/functions.texi
@@ -811,7 +811,7 @@ anonymous function. Such a list is valid wherever a function name is.
@smallexample
@group
-(setq silly (append (lambda (x)) (list (list '+ (* 3 4) 'x))))
+(setq silly (append '(lambda (x)) (list (list '+ (* 3 4) 'x))))
@result{} (lambda (x) (+ 12 x))
@end group
@end smallexample
@@ -858,7 +858,7 @@ passing it a function to double a number:
@example
@group
(defun double-property (symbol prop)
- (change-property symbol prop (lambda (x) (* 2 x))))
+ (change-property symbol prop '(lambda (x) (* 2 x))))
@end group
@end example
@@ -892,6 +892,18 @@ do with the list. Perhaps it will check whether the @sc{car} of the third
element is the symbol @code{*}! Using @code{function} tells the
compiler it is safe to go ahead and compile the constant function.
+ Nowadays it is possible to omit @code{function} entirely, like this:
+
+@example
+@group
+(defun double-property (symbol prop)
+ (change-property symbol prop (lambda (x) (* 2 x))))
+@end group
+@end example
+
+@noindent
+This is because @code{lambda} itself implies @code{function}.
+
We sometimes write @code{function} instead of @code{quote} when
quoting the name of a function, but this usage is just a sort of
comment: