Mercurial > emacs
comparison man/cl.texi @ 60927:bae786986f2e
* calc.texi, cl.texi, gnus.texi, idlwave.texi, reftex.texi: Replace
`legal' with `valid'.
author | Werner LEMBERG <wl@gnu.org> |
---|---|
date | Fri, 25 Mar 2005 10:17:33 +0000 |
parents | 1986f67220dd |
children | 0129c2b09b4a 4da4a09e8b1b |
comparison
equal
deleted
inserted
replaced
60926:89202ce14f61 | 60927:bae786986f2e |
---|---|
3 @settitle Common Lisp Extensions | 3 @settitle Common Lisp Extensions |
4 | 4 |
5 @copying | 5 @copying |
6 This file documents the GNU Emacs Common Lisp emulation package. | 6 This file documents the GNU Emacs Common Lisp emulation package. |
7 | 7 |
8 Copyright (C) 1993, 2002 Free Software Foundation, Inc. | 8 Copyright (C) 1993, 2002, 2005 Free Software Foundation, Inc. |
9 | 9 |
10 @quotation | 10 @quotation |
11 Permission is granted to copy, distribute and/or modify this document | 11 Permission is granted to copy, distribute and/or modify this document |
12 under the terms of the GNU Free Documentation License, Version 1.1 or | 12 under the terms of the GNU Free Documentation License, Version 1.1 or |
13 any later version published by the Free Software Foundation; with no | 13 any later version published by the Free Software Foundation; with no |
989 @var{place} and @var{form} pairs, the assignments are done sequentially | 989 @var{place} and @var{form} pairs, the assignments are done sequentially |
990 just as with @code{setq}. @code{setf} returns the value of the last | 990 just as with @code{setq}. @code{setf} returns the value of the last |
991 @var{form}. | 991 @var{form}. |
992 | 992 |
993 The following Lisp forms will work as generalized variables, and | 993 The following Lisp forms will work as generalized variables, and |
994 so may legally appear in the @var{place} argument of @code{setf}: | 994 so may appear in the @var{place} argument of @code{setf}: |
995 | 995 |
996 @itemize @bullet | 996 @itemize @bullet |
997 @item | 997 @item |
998 A symbol naming a variable. In other words, @code{(setf x y)} is | 998 A symbol naming a variable. In other words, @code{(setf x y)} is |
999 exactly equivalent to @code{(setq x y)}, and @code{setq} itself is | 999 exactly equivalent to @code{(setq x y)}, and @code{setq} itself is |
1071 sequences of code when they are @code{setf}'d (@code{(narrow-to-region | 1071 sequences of code when they are @code{setf}'d (@code{(narrow-to-region |
1072 x (point-max))} in this case). | 1072 x (point-max))} in this case). |
1073 | 1073 |
1074 @item | 1074 @item |
1075 A call of the form @code{(substring @var{subplace} @var{n} [@var{m}])}, | 1075 A call of the form @code{(substring @var{subplace} @var{n} [@var{m}])}, |
1076 where @var{subplace} is itself a legal generalized variable whose | 1076 where @var{subplace} is itself a valid generalized variable whose |
1077 current value is a string, and where the value stored is also a | 1077 current value is a string, and where the value stored is also a |
1078 string. The new string is spliced into the specified part of the | 1078 string. The new string is spliced into the specified part of the |
1079 destination string. For example: | 1079 destination string. For example: |
1080 | 1080 |
1081 @example | 1081 @example |
2377 @result{} (0 1 2 3 4 5 6 7 8 9) | 2377 @result{} (0 1 2 3 4 5 6 7 8 9) |
2378 @end example | 2378 @end example |
2379 | 2379 |
2380 The @code{by} value is always positive, even for downward-counting | 2380 The @code{by} value is always positive, even for downward-counting |
2381 loops. Some sort of @code{from} value is required for downward | 2381 loops. Some sort of @code{from} value is required for downward |
2382 loops; @samp{for x downto 5} is not a legal loop clause all by | 2382 loops; @samp{for x downto 5} is not a valid loop clause all by |
2383 itself. | 2383 itself. |
2384 | 2384 |
2385 @item for @var{var} in @var{list} by @var{function} | 2385 @item for @var{var} in @var{list} by @var{function} |
2386 This clause iterates @var{var} over all the elements of @var{list}, | 2386 This clause iterates @var{var} over all the elements of @var{list}, |
2387 in turn. If you specify the @code{by} term, then @var{function} | 2387 in turn. If you specify the @code{by} term, then @var{function} |
2479 are also recognized but are equivalent to @code{symbols} in Emacs Lisp. | 2479 are also recognized but are equivalent to @code{symbols} in Emacs Lisp. |
2480 | 2480 |
2481 Due to a minor implementation restriction, it will not work to have | 2481 Due to a minor implementation restriction, it will not work to have |
2482 more than one @code{for} clause iterating over symbols, hash tables, | 2482 more than one @code{for} clause iterating over symbols, hash tables, |
2483 keymaps, overlays, or intervals in a given @code{loop}. Fortunately, | 2483 keymaps, overlays, or intervals in a given @code{loop}. Fortunately, |
2484 it would rarely if ever be useful to do so. It @emph{is} legal to mix | 2484 it would rarely if ever be useful to do so. It @emph{is} valid to mix |
2485 one of these types of clauses with other clauses like @code{for ... to} | 2485 one of these types of clauses with other clauses like @code{for ... to} |
2486 or @code{while}. | 2486 or @code{while}. |
2487 | 2487 |
2488 @item for @var{var} being the hash-keys of @var{hash-table} | 2488 @item for @var{var} being the hash-keys of @var{hash-table} |
2489 This clause iterates over the entries in @var{hash-table}. For each | 2489 This clause iterates over the entries in @var{hash-table}. For each |
2725 unnamed temporary variable. Also, @code{into} accumulations do | 2725 unnamed temporary variable. Also, @code{into} accumulations do |
2726 not automatically imply a return value. The loop must use some | 2726 not automatically imply a return value. The loop must use some |
2727 explicit mechanism, such as @code{finally return}, to return | 2727 explicit mechanism, such as @code{finally return}, to return |
2728 the accumulated result. | 2728 the accumulated result. |
2729 | 2729 |
2730 It is legal for several accumulation clauses of the same type to | 2730 It is valid for several accumulation clauses of the same type to |
2731 accumulate into the same place. From Steele: | 2731 accumulate into the same place. From Steele: |
2732 | 2732 |
2733 @example | 2733 @example |
2734 (loop for name in '(fred sue alice joe june) | 2734 (loop for name in '(fred sue alice joe june) |
2735 for kids in '((bob ken) () () (kris sunshine) ()) | 2735 for kids in '((bob ken) () () (kris sunshine) ()) |
3246 | 3246 |
3247 @example | 3247 @example |
3248 (get sym prop) @equiv{} (getf (symbol-plist sym) prop) | 3248 (get sym prop) @equiv{} (getf (symbol-plist sym) prop) |
3249 @end example | 3249 @end example |
3250 | 3250 |
3251 It is legal to use @code{getf} as a @code{setf} place, in which case | 3251 It is valid to use @code{getf} as a @code{setf} place, in which case |
3252 its @var{place} argument must itself be a legal @code{setf} place. | 3252 its @var{place} argument must itself be a valid @code{setf} place. |
3253 The @var{default} argument, if any, is ignored in this context. | 3253 The @var{default} argument, if any, is ignored in this context. |
3254 The effect is to change (via @code{setcar}) the value cell in the | 3254 The effect is to change (via @code{setcar}) the value cell in the |
3255 list that corresponds to @var{property}, or to cons a new property-value | 3255 list that corresponds to @var{property}, or to cons a new property-value |
3256 pair onto the list if the property is not yet present. | 3256 pair onto the list if the property is not yet present. |
3257 | 3257 |
3533 date and time. As an extension to Common Lisp, @var{state} may also | 3533 date and time. As an extension to Common Lisp, @var{state} may also |
3534 be an integer in which case the new object is seeded from that | 3534 be an integer in which case the new object is seeded from that |
3535 integer; each different integer seed will result in a completely | 3535 integer; each different integer seed will result in a completely |
3536 different sequence of random numbers. | 3536 different sequence of random numbers. |
3537 | 3537 |
3538 It is legal to print a @code{random-state} object to a buffer or | 3538 It is valid to print a @code{random-state} object to a buffer or |
3539 file and later read it back with @code{read}. If a program wishes | 3539 file and later read it back with @code{read}. If a program wishes |
3540 to use a sequence of pseudo-random numbers which can be reproduced | 3540 to use a sequence of pseudo-random numbers which can be reproduced |
3541 later for debugging, it can call @code{(make-random-state t)} to | 3541 later for debugging, it can call @code{(make-random-state t)} to |
3542 get a new sequence, then print this sequence to a file. When the | 3542 get a new sequence, then print this sequence to a file. When the |
3543 program is later rerun, it can read the original run's random-state | 3543 program is later rerun, it can read the original run's random-state |
4573 The argument names should match the slot names; each slot is | 4573 The argument names should match the slot names; each slot is |
4574 initialized from the corresponding argument. Slots whose names | 4574 initialized from the corresponding argument. Slots whose names |
4575 do not appear in the argument list are initialized based on the | 4575 do not appear in the argument list are initialized based on the |
4576 @var{default-value} in their slot descriptor. Also, @code{&optional} | 4576 @var{default-value} in their slot descriptor. Also, @code{&optional} |
4577 and @code{&key} arguments which don't specify defaults take their | 4577 and @code{&key} arguments which don't specify defaults take their |
4578 defaults from the slot descriptor. It is legal to include arguments | 4578 defaults from the slot descriptor. It is valid to include arguments |
4579 which don't correspond to slot names; these are useful if they are | 4579 which don't correspond to slot names; these are useful if they are |
4580 referred to in the defaults for optional, keyword, or @code{&aux} | 4580 referred to in the defaults for optional, keyword, or @code{&aux} |
4581 arguments which @emph{do} correspond to slots. | 4581 arguments which @emph{do} correspond to slots. |
4582 | 4582 |
4583 You can specify any number of full-format @code{:constructor} | 4583 You can specify any number of full-format @code{:constructor} |