![[LISPWORKS]](/image.pl?url=http%3a%2f%2fwww.lispworks.com%2fdocumentation%2fHyperSpec%2fBody%2f..%2fGraphics%2fLWSmall.gif&f=jpg&w=240)
![[Common Lisp HyperSpec (TM)]](/image.pl?url=http%3a%2f%2fwww.lispworks.com%2fdocumentation%2fHyperSpec%2fBody%2f..%2fGraphics%2fCLHS_Sm.gif&f=jpg&w=240)
Syntax:
copy-readtable&optional from-readtable to-readtable =>readtable
Arguments and Values:
from-readtable---areadtable designator. The default is thecurrent readtable.
to-readtable---areadtable ornil. The default isnil.
readtable---theto-readtable if it isnon-nil, or else afreshreadtable.
Description:
copy-readtable copiesfrom-readtable.
Ifto-readtable isnil, a newreadtable is created and returned. Otherwise thereadtable specified byto-readtable is modified and returned.
copy-readtable copies the setting ofreadtable-case.
Examples:
(setq zvar 123) => 123 (set-syntax-from-char #\z #\' (setq table2 (copy-readtable))) => T zvar => 123 (copy-readtable table2 *readtable*) => #<READTABLE 614000277> zvar => VAR (setq *readtable* (copy-readtable)) => #<READTABLE 46210223> zvar => VAR (setq *readtable* (copy-readtable nil)) => #<READTABLE 46302670> zvar => 123
Affected By: None.
Exceptional Situations: None.
See Also:
Notes:
(setq *readtable* (copy-readtable nil))restores the input syntax to standard Common Lisp syntax, even if theinitial readtable has been clobbered (assuming it is not so badly clobbered that you cannot type in the above expression).
On the other hand,
(setq *readtable* (copy-readtable))replaces the currentreadtable with a copy of itself. This is useful if you want to save a copy of a readtable for later use, protected from alteration in the meantime. It is also useful if you want to locally bind the readtable to a copy of itself, as in:
(let ((*readtable* (copy-readtable))) ...)