Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
09094f28
Commit
09094f28
authored
Oct 07, 2009
by
Chong Yidong
Browse files
* cl.texi (Argument Lists): Clarify explicit keyword arguments.
parent
5c4634c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
doc/misc/ChangeLog
doc/misc/ChangeLog
+4
-0
doc/misc/cl.texi
doc/misc/cl.texi
+19
-8
No files found.
doc/misc/ChangeLog
View file @
09094f28
2009-10-07 Chong Yidong <cyd@stupidchicken.com>
* cl.texi (Argument Lists): Clarify explicit keyword arguments.
2009-10-07 Juanma Barranquero <lekktu@gmail.com>
* makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add eieio, ede.
...
...
doc/misc/cl.texi
View file @
09094f28
...
...
@@ -457,15 +457,26 @@ argument @code{b} as well, since @code{(foo 1 :c 2)} would bind
@code{b} to the keyword @code{:c}, then signal an error because
@code{2} is not a valid keyword.
If a @var{keyword} symbol is explicitly specified in the argument
list as shown in the above diagram, then that keyword will be
used instead of just the variable name prefixed with a colon.
You can specify a @var{keyword} symbol which does not begin with
a colon at all, but such symbols will not be self-quoting; you
will have to quote them explicitly with an apostrophe in the
function call.
You can also explicitly specify the keyword argument; it need not be
simply the variable name prefixed with a colon. For example,
@example
(defun* bar (&key (a 1) ((baz b) 4)))
@end example
@noindent
specifies a keyword @code{:a} that sets the variable @code{a} with
default value 1, as well as a keyword @code{baz} that sets the
variable @code{b} with default value 4. In this case, because
@code{baz} is not self-quoting, you must quote it explicitly in the
function call, like this:
@example
(bar :a 10 'baz 42)
@end example
Ordinarily it is an error to pass an unrecognized keyword to
Ordinarily
,
it is an error to pass an unrecognized keyword to
a function, e.g., @code{(foo 1 2 :c 3 :goober 4)}. You can ask
Lisp to ignore unrecognized keywords, either by adding the
marker @code{&allow-other-keys} after the keyword section
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment