Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 1.096 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
1.096
Dung lượng
4,42 MB
Nội dung
Contents Preface (Second Edition) xi Acknowledgments (Second Edition) xiii Acknowledgments (First Edition) xvii Introduction 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 Purpose Notational Conventions Decimal Numbers Nil, False, and the Empty List Evaluation, Expansion, and Equivalence Errors Descriptions of Functions and Other Entities The Lisp Reader 10 Overview of Syntax 10 Data Types 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 13 Numbers 16 Integers 17 Ratios 19 Floating-Point Numbers 20 Complex Numbers 24 Characters 24 Standard Characters 25 Line Divisions 26 Non-standard Characters 27 Character Attributes 28 String Characters 28 2.3 2.4 2.5 2.5.1 2.5.2 2.5.3 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 Symbols 29 Lists and Conses 32 Arrays 33 Vectors 35 Strings 36 Bit-Vectors 37 Hash Tables 38 Readtables 38 Packages 38 Pathnames 38 Streams 38 Random-States 39 Structures 39 Functions 39 Unreadable Data Objects 40 Overlap, Inclusion, and Disjointness of Types 41 Scope and Extent 46 Type Specifiers 4.1 4.2 4.3 4.4 4.5 4.6 53 Type Speci er Symbols 53 Type Speci er Lists 53 Predicating Type Speci ers 55 Type Speci ers That Combine 55 Type Speci ers That Specialize 57 Type Speci ers That Abbreviate 64 v vi CONTENTS 4.7 De ning New Type Speci ers 66 4.8 Type Conversion Function 68 4.9 Determining the Type of an Object 70 4.10 Type Upgrading 72 Program Structure 5.1 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.2 5.2.1 5.2.2 5.3 5.3.1 5.3.2 73 Forms 73 Self-Evaluating Forms 74 Variables 74 Special Forms 76 Macros 78 Function Calls 79 Functions 79 Named Functions 80 Lambda-Expressions 80 Top-Level Forms 88 De ning Named Functions 90 Declaring Global Variables and Named Constants 92 5.3.3 Control of Time of Evaluation 94 Predicates 101 6.1 Logical Values 102 6.2 Data Type Predicates 102 6.2.1 General Type Predicates 102 6.2.2 Speci c Data Type Predicates 105 6.3 Equality Predicates 110 6.4 Logical Operators 116 Control Structure 119 7.1 Constants and Variables 120 7.1.1 Reference 120 7.1.2 Assignment 127 7.2 Generalized Variables 129 7.3 Function Invocation 154 7.4 Simple Sequencing 155 7.5 Establishing New Variable Bindings 157 7.6 Conditionals 165 7.7 Blocks and Exits 170 7.8 7.8.1 7.8.2 7.8.3 Iteration 172 Inde nite Iteration 172 General Iteration 173 Simple Iteration Constructs 178 7.8.4 Mapping 180 7.8.5 The \Program Feature" 183 7.9 Structure Traversal and Side E ects 188 7.10 Multiple Values 189 7.10.1 Constructs for Handling Multiple Values 190 7.10.2 Rules Governing the Passing of Multiple Values 195 7.11 Dynamic Non-Local Exits 198 Macros 8.1 8.2 8.3 8.4 8.5 205 Macro De nition 206 Macro Expansion 215 Destructuring 217 Compiler Macros 217 Environments 220 Declarations 9.1 9.2 9.3 228 Declaration Syntax 228 Declaration Speci ers 237 Type Declaration for Forms 252 10 Symbols 254 10.1 The Property List 254 10.2 The Print Name 259 10.3 Creating Symbols 260 11 Packages 11.1 11.2 11.3 11.4 11.5 11.6 264 Consistency Rules 266 Package Names 266 Translating Strings to Symbols 268 Exporting and Importing Symbols 270 Name Con icts 272 Built-in Packages 275 CONTENTS 11.7 Package System Functions and Variables 279 11.8 Modules 295 11.9 An Example 296 12 Numbers 307 12.1 Precision, Contagion, and Coercion 308 12.2 Predicates on Numbers 312 12.3 Comparisons on Numbers 313 12.4 Arithmetic Operations 315 12.5 Irrational and Transcendental Functions 319 12.5.1 Exponential and Logarithmic Functions 320 12.5.2 Trigonometric and Related Functions 323 12.5.3 Branch Cuts, Principal Values, and Boundary Conditions in the Complex Plane 332 12.6 Type Conversions and Component Extractions on Numbers 375 12.7 Logical Operations on Numbers 382 12.8 Byte Manipulation Functions 388 12.9 Random Numbers 391 12.10 Implementation Parameters 394 13 Characters 398 13.1 Character Attributes 401 13.2 Predicates on Characters 403 13.3 Character Construction and Selection 409 13.4 Character Conversions 410 13.5 Character Control-Bit Functions 413 14 Sequences 415 14.1 Simple Sequence Functions 419 vii 14.2 Concatenating, Mapping, and Reducing Sequences 421 14.3 Modifying Sequences 426 14.4 Searching Sequences for Items 432 14.5 Sorting and Merging 436 15 Lists 15.1 15.2 15.3 15.4 15.5 15.6 440 Conses 440 Lists 442 Alteration of List Structure 453 Substitution of Expressions 455 Using Lists as Sets 457 Association Lists 463 16 Hash Tables 468 16.1 Hash Table Functions 469 16.2 Primitive Hash Function 475 17 Arrays 17.1 17.2 17.3 17.4 17.5 17.6 476 Array Creation 476 Array Access 481 Array Information 482 Functions on Arrays of Bits 487 Fill Pointers 489 Changing the Dimensions of an Array 490 18 Strings 495 18.1 String Access 496 18.2 String Comparison 496 18.3 String Construction and Manipulation 499 19 Structures 504 19.1 Introduction to Structures 504 19.2 How to Use Defstruct 506 viii CONTENTS 19.3 Using the Automatically De ned Constructor Function 510 19.4 Defstruct Slot-Options 512 19.5 Defstruct Options 513 19.6 By-Position Constructor Functions 519 19.7 Structures of Explicitly Speci ed Representational Type 523 19.7.1 Unnamed Structures 523 19.7.2 Named Structures 524 19.7.3 Other Aspects of Explicitly Speci ed Structures 526 20 The Evaluator 528 20.1 Run-Time Evaluation of Forms 528 20.2 The Top-Level Loop 532 21 Streams 535 21.1 Standard Streams 535 21.2 Creating New Streams 538 21.3 Operations on Streams 542 22 Input/Output 547 22.1 Printed Representation of Lisp Objects 547 22.1.1 What the Read Function Accepts 548 22.1.2 Parsing of Numbers and Symbols 554 22.1.3 Macro Characters 563 22.1.4 Standard Dispatching Macro Character Syntax 570 22.1.5 The Readtable 582 22.1.6 What the Print Function Produces 593 22.2 Input Functions 611 22.2.1 Input from Character Streams 611 22.2.2 Input from Binary Streams 622 22.3 Output Functions 622 22.3.1 Output to Character Streams 623 22.3.2 Output to Binary Streams 627 22.3.3 Formatted Output to Character Streams 627 22.4 Querying the User 659 23 File System Interface 661 23.1 File Names 661 23.1.1 Pathnames 662 23.1.2 Case Conventions 668 23.1.3 Structured Directories 672 23.1.4 Extended Wildcards 675 23.1.5 Logical Pathnames 681 23.1.5.1 Syntax of Logical Pathname Namestrings 681 23.1.5.2 Parsing of Logical Pathname Namestrings 682 23.1.5.3 Using Logical Pathnames 683 23.1.5.4 Examples of the Use of Logical Pathnames 686 23.1.5.5 Discussion of Logical Pathnames 688 23.1.6 Pathname Functions 690 23.2 Opening and Closing Files 700 23.3 Renaming, Deleting, and Other File Operations 707 23.4 Loading Files 712 23.5 Accessing Directories 718 24 Errors 720 24.1 General Error-Signaling Functions 721 24.2 Specialized Error-Signaling Forms and Macros 726 24.3 Special Forms for Exhaustive Case Analysis 729 25 Miscellaneous Features 25.1 The Compiler 732 25.1.1 Compiler Diagnostics 740 732 CONTENTS ix 25.1.2 Compiled Functions 741 25.1.3 Compilation Environment 742 25.1.4 Similarity of Constants 747 25.2 Documentation 751 25.3 Debugging Tools 752 25.4 Environment Inquiries 759 25.4.1 Time Functions 759 25.4.2 Other Environment Inquiries 763 25.5 Identity Function 765 26 Loop 767 26.1 Introduction 767 26.2 How the Loop Facility Works 767 26.3 Parsing Loop Clauses 768 26.3.1 Order of Execution 769 26.3.2 Kinds of Loop Clauses 770 26.3.3 Loop Syntax 773 26.4 User Extensibility 773 26.5 Loop Constructs 773 26.6 Iteration Control 774 26.7 End-Test Control 785 26.8 Value Accumulation 789 26.9 Variable Initializations 795 26.10 Conditional Execution 798 26.11 Unconditional Execution 800 26.12 Miscellaneous Features 802 26.12.1 Data Types 802 26.12.2 Destructuring 803 27 Pretty Printing 808 27.1 Introduction 808 27.2 Pretty Printing Control Variables 809 27.3 Dynamic Control of the Arrangement of Output 810 27.4 Format Directive Interface 822 27.5 Compiling Format Control Strings 825 27.6 Pretty Printing Dispatch Tables 826 28 Common Lisp Object System 831 28.1 Programmer Interface Concepts 831 28.1.1 Error Terminology 832 28.1.2 Classes 835 28.1.2.1 De ning Classes 836 28.1.2.2 Creating Instances of Classes 837 28.1.2.3 Slots 837 28.1.2.4 Accessing Slots 839 28.1.3 Inheritance 841 28.1.3.1 Inheritance of Methods 841 28.1.3.2 Inheritance of Slots and Slot Options 841 28.1.3.3 Inheritance of Class Options 843 28.1.3.4 Examples 843 28.1.4 Integrating Types and Classes 843 28.1.5 Determining the Class Precedence List 845 28.1.5.1 Topological Sorting 848 28.1.5.2 Examples 848 28.1.6 Generic Functions and Methods 851 28.1.6.1 Introduction to Generic Functions 851 28.1.6.2 Introduction to Methods 852 28.1.6.3 Agreement on Parameter Specializers and Quali ers 855 28.1.6.4 Congruent Lambda-Lists for All Methods of a Generic Function 856 28.1.6.5 Keyword Arguments in Generic Functions and Methods 856 28.1.7 Method Selection and Combination 858 28.1.7.1 Determining the E ective Method 858 28.1.7.2 Standard Method Combination 861 x CONTENTS 28.1.7.3 Declarative Method Combination 863 28.1.7.4 Built-in Method Combination Types 863 28.1.8 Meta-objects 865 28.1.8.1 Metaclasses 866 28.1.8.2 Standard Metaclasses 866 28.1.8.3 Standard Meta-objects 866 28.1.9 Object Creation and Initialization 867 28.1.9.1 Initialization Arguments 868 28.1.9.2 Declaring the Validity of Initialization Arguments 869 28.1.9.3 Defaulting of Initialization Arguments 870 28.1.9.4 Rules for Initialization Arguments 871 28.1.9.5 Shared-Initialize 873 28.1.9.6 Initialize-Instance 874 28.1.9.7 De nitions of Make-Instance and Initialize-Instance 876 28.1.10 Rede ning Classes 878 28.1.10.1 Modifying the Structure of Instances 879 28.1.10.2 Initializing Newly Added Local Slots 879 28.1.10.3 Customizing Class Rede nition 880 28.1.10.4 Extensions 880 28.1.11 Changing the Class of an Instance 881 28.1.11.1 Modifying the Structure of an Instance 881 28.1.11.2 Initializing Newly Added Local Slots 881 28.1.11.3 Customizing the Change of Class of an Instance 882 28.1.12 Reinitializing an Instance 882 28.1.12.1 Customizing Reinitialization 884 28.2 Functions in the Programmer Interface 884 29 Conditions 939 29.1 Introduction 939 29.2 Changes in Terminology 941 29.3 Survey of Concepts 942 29.3.1 Signaling Errors 942 29.3.2 Trapping Errors 944 29.3.3 Handling Conditions 946 29.3.4 Object-Oriented Basis of Condition Handling 947 29.3.5 Restarts 949 29.3.6 Anonymous Restarts 949 29.3.7 Named Restarts 951 29.3.8 Restart Functions 952 29.3.9 Comparison of Restarts and Catch/Throw 953 29.3.10 Generalized Restarts 955 29.3.11 Interactive Condition Handling 956 29.3.12 Serious Conditions 956 29.3.13 Non-Serious Conditions 957 29.3.14 Condition Types 957 29.3.15 Signaling Conditions 958 29.3.16 Resignaling Conditions 959 29.3.17 Condition Handlers 959 29.3.18 Printing Conditions 960 29.4 Program Interface to the Condition System 961 29.4.1 Signaling Conditions 961 29.4.2 Assertions 964 29.4.3 Exhaustive Case Analysis 968 29.4.4 Handling Conditions 970 29.4.5 De ning Conditions 974 29.4.6 Creating Conditions 977 29.4.7 Establishing Restarts 978 29.4.8 Finding and Manipulating Restarts 987 29.4.9 Warnings 989 29.4.10 Restart Functions 990 29.4.11 Debugging Utilities 992 29.5 Prede ned Condition Types 993 Appendix A Series A.1 1001 Introduction 1001 CONTENTS A.2 A.2.1 A.2.2 A.2.3 A.2.4 A.2.5 A.2.6 A.3 A.3.1 A.3.2 A.3.3 A.3.4 A.4 xi Series Functions 1003 Scanners 1004 Mapping 1008 Truncation and Other Simple Transducers 1011 Conditional and Other Complex Transducers 1013 Collectors 1017 Alteration of Series 1020 Optimization 1022 Basic Restrictions 1023 Constraint Cycles 1024 De ning New Series Functions 1027 Declarations 1028 Primitives 1030 Appendix B Generators and Gatherers 1036 B.1 B.2 B.3 B.4 Introduction 1036 Generators 1037 Gatherers 1037 Discussion 1039 Appendix C Backquote References 1040 1053 Index of X3J13 Votes Other Indexes 1064 1058 xii CONTENTS Preface SECOND EDITION Common Lisp has succeeded Since publication of the rst edition of this book in 1984, many implementors have used it as a de facto standard for Lisp implementation As a result, it is now much easier to port large Lisp programs from one implementation to another Common Lisp has proved to be a useful and stable platform for rapid prototyping and systems delivery in arti cial intelligence and other areas With experience gained in using Common Lisp for so many applications, implementors found no shortage of opportunities for innovation One of the important characteristics of Lisp is its good support for experimental extension of the language while Common Lisp has been stable, it has not stagnated The 1984 de nition of Common Lisp was imperfect and incomplete In some cases this was inadvertent: some odd boundary situation was overlooked and its consequences not speci ed, or di erent passages were in ict, or some property of Lisp was so well-known and traditionally relied upon that I forgot to write it down In other cases the informal committee that was de ning Common Lisp could not settle on a solution, and therefore agreed to leave some important aspect of the language unspeci ed rather than choose a less than satisfactory de nition An example is error handling 1984 Common Lisp had plenty of ways to signal errors but no way for a program to trap or process them Over the next year I collected reports of errors in the book and gaps in the language In December 1985, a group of implementors and users met in Boston to discuss the state of Common Lisp I prepared two lists for this meeting, one of errata and clari cations that I thought would be relatively uncontroversial (boy, was I wrong!) and one of more substantial changes I thought should be considered and perhaps voted upon Others also brought proposals to discuss It became clear to everyone that there was now enough interest in Common Lisp, and dependence on its stability, that a more formal mechanism was needed for managing changes to the language xiii xiv PREFACE (SECOND EDITION) This realization led to the formation of X3J13, a subcommittee of ANSI committee X3, to produce a formal American National Standard for Common Lisp That process is nearing completion X3J13 has completed the bulk of its technical work in rectifying the 1984 de nition and codifying extensions to that de nition that have received widespread use and approval A draft standard is now being prepared it will probably be available in 1990 There will then be a period (required by ANSI) for public review X3J13 must then consider the comments it receives and respond appropriately If the comments result in substantial changes to the draft standard, multiple public review periods may be required before the draft can be approved as an American National Standard Fortunately, X3J13 has done an outstanding job of documenting its work For every change that came to a formal vote, a document was prepared that described the problem to be solved and one or more solutions For each solution there is a detailed proposal for changing the language a rationale test cases that distinguish the proposal from the status quo or from other proposals for solving that problem discussions of current practice, cost to implementors, cost to users, cost of not adopting the proposal, bene ts of adoption, aesthetic criteria and any relevant informal discussion that may have preceded creation of the formal proposal All of these proposal documents were made available on-line as well as in paper form By my count, by June 1989 some 186 such proposals were approved as language changes (This count does not include many proposals that came before the committee but were rejected.) The purpose of this second edition is to bridge the gap between the rst edition and the forthcoming ANSI standard for Common Lisp Because of the requirement for formal public review, it will be some time yet before the ANSI standard is nal This book in no way resembles the forthcoming standard (which is being written independently by Kathy Chapman of Digital Equipment Corporation with assistance from the X3J13 Drafting Subcommittee) I have incorporated into this second edition a great deal of material based on the votes of X3J13, in order to give the reader a picture of where the language is heading My purpose here is not simply to quote the X3J13 documents verbatim but to paraphrase them and relate them to the structure of the rst edition A single vote by X3J13 may be discussed in many parts of this book, and a single passage of this book may be a ected by many of the votes I wish to be very clear: this book is not an o cial document of X3J13, though it is based on publicly available material produced by X3J13 In no way does this book constitute a de nitive description of the forthcoming ANSI standard The committee's decisions have been remarkably stable (it Index of X3J13 Votes This is an index of issues voted upon by X3J13 For the bene t of those readers who may wish to cross-reference to the X3J13 working documents or to the minutes of the X3J13 meetings, each vote is identi ed below by the (sometimes whimsical) descriptive label used in X3J13 discussions Each label consists of the name of an issue and the name of the solution that was approved (many issues had more than one proposed solution) separated by a colon A few solutions had no explicit name Page numbers indicate where each issue is cited in the text a following number in parentheses indicates that the issue is cited that many times on the page h1i h2i h3i h4i h5i h6i h7i h8i h9i h10i h11i h12i h13i h14i h15i h16i h17i 1058 ADJUST-ARRAY-DISPLACEMENT:RULES 458 ADJUST-ARRAY-FILL-POINTER:MINIMAL 456 ADJUST-ARRAY-NOT-ADJUSTABLE:IMPLICIT-COPY 32, 444, 445, 452, 455, 457 ALLOW-LOCAL-INLINE:INLINE-NOTINLINE 230 APPLYHOOK-ENVIROMENT:REMOVE-ENV 491, 493 AREF-1D:ROW-MAJOR-AREF 125, 450 ARGUMENTS-UNDERSPECIFIED:SPECIFY 122, 360, 394, 416, 437, 464, 541, 546, 567 ARRAY-TYPE-ELEMENT-TYPE-SEMANTICS:UNIFY-UPGRADING 98, 443 ASSOC-RASSOC-IF-KEY:YES 432, 433 BREAK-ON-WARNINGS-OBSOLETE:REMOVE 668, 669, 889 CHARACTER-PROPOSAL 23, 26(2), 33, 39, 40(2), 49, 50(2), 53, 54, 57, 67, 96, 56, 61, 64(2), 126(2), 134, 238, 243, 266, 371, 374, 375(2), 376, 379, 381, 382(3), 383, 384(2), 385, 386, 387(2), 394, 442, 460, 461, 464, 466, 515, 533, 540, 588 CLOS 15, 51, 73, 140, 155, 216, 472, 695, 770, 921 CLOS-MACRO-COMPILATION:MINIMAL 690 CLOSE-CONSTRUCTED-STREAM:ARGUMENT-STREAM-ONLY 506 CLOSED-STREAM-OPERATIONS:ALLOW-INQUIRY 504, 505, 638, 639, 641, 644, 645, 646, 654, 663 COLON-NUMBER:UNDEFINED 521, 522 COMMON-TYPE:REMOVE 12, 41, 49, 50, 51, 103 REFERENCES h18i h19i h20i h21i h22i h23i h24i h25i h26i h27i h28i h29i h30i h31i h32i h33i h34i h35i h36i h37i h38i h39i h40i h41i h42i h43i h44i h45i h46i h47i h48i h49i h50i h51i h52i h53i h54i h55i h56i h57i h58i h59i h60i 1059 COMPILE-ARGUMENT-PROBLEMS:CLARIFY 677 COMPILE-ENVIRONMENT-CONSISTENCY:CLARIFY 685 COMPILE-FILE-HANDLING-OF-TOP-LEVEL-FORMS:CLARIFY 687 COMPILE-FILE-PACKAGE:REBIND 262, 678 COMPILE-FILE-SYMBOL-HANDLING:NEW-REQUIRE-CONSISTENCY 678, 692 COMPILED-FUNCTION-REQUIREMENTS:TIGHTEN 685 COMPILER-DIAGNOSTICS:USE-HANDLER 677, 678, 683 COMPILER-LET-CONFUSION:ELIMINATE 73, 151 COMPILER-VERBOSITY:LIKE-LOAD 657, 658, 678, 680(2) COMPILER-WARNING-STREAM:ERROR-OUTPUT 683 COMPLEX-ATAN-BRANCH-CUT:TWEAK 307, 309, 312 COMPLEX-RATIONAL-RESULT:EXTEND 299, 300 CONDITION-SYSTEM 14, 664, 666, 667, 669, 670, 671, 672, 673, 674(3), 865 CONDITION-RESTARTS:PERMIT-ASSOCIATION 216, 865, 910 CONSTANT-CIRCULAR-COMPILATION:YES 115, 694 CONSTANT-COLLAPSING:GENERALIZE 694 CONSTANT-COMPILABLE-TYPES:SPECIFY 115, 691 CONSTANT-FUNCTION-COMPILATION:NO 693 CONSTANT-MODIFICATION:DISALLOW 70, 115, 694 CONTAGION-ON-NUMERICAL-COMPARISONS:TRANSITIVE 109, 290, 437 COPY-SYMBOL-COPY-PLIST:COPY-LIST 244 COPY-SYMBOL-PRINT-NAME:EQUAL 244 DATA-IO:ADD-SUPPORT 216, 524, 534, 539, 551, 552, 553(2), 554(2), 555, 556(2), 557(2), 565, 577, 579, 580, 851 DATA-TYPES-HIERARCHY-UNDERSPECIFIED:DISJOINT 38, 41, 479, 782, 783 DECLARATION-SCOPE:NO-HOISTING 219 DECLARE-ARRAY-TYPE-ELEMENT-REFERENCES:RESTRICTIVE 55 DECLARE-FUNCTION-AMBIGUITY:DELETE-FTYPE-ABBREVIATION 228 DECLARE-MACROS:FLUSH 217 DECLARE-TYPE-FREE:LEXICAL 219, 222, 224 DECODE-UNIVERSAL-TIME-DAYLIGHT:LIKE-ENCODE 704 DEFCONSTANT-SPECIAL:DOESNT-MATTER 87 DEFINE-COMPILER-MACRO:NEW-FACILITY 125, 205, 260 DEFINING-MACROS-NON-TOP-LEVEL:ALLOW 63, 84(2), 139, 143, 153, 195, 207, 472 DEFMACRO-LAMBDA-LIST:TIGHTEN-DESCRIPTION 197 DEFPACKAGE:ADDITION 269, 280 DEFSTRUCT-CONSTRUCTOR-KEY-MIXTURE:ALLOW-KEY 483 DEFSTRUCT-DEFAULT-VALUE-EVALUATION:IFF-NEEDED 472, DEFSTRUCT-PRINT-FUNCTION-INHERITANCE:YES 480 DEFSTRUCT-REDEFINITION:ERROR 473 DEFSTRUCT-SLOTS-CONSTRAINTS-NAME:DUPLICATES-ERROR DEFSTRUCT-SLOTS-CONSTRAINTS-NUMBER:ALLOW-ZERO 471 DEFVAR-DOCUMENTATION:UNEVALUATED 87 DEFVAR-INIT-TIME:NOT-DELAYED 86 474 472 1060 h61i h62i h63i h64i h65i h66i h67i h68i h69i h70i h71i h72i h73i h74i h75i h76i h77i h78i h79i h80i h81i h82i h83i h84i h85i h86i h87i h88i h89i h90i h91i h92i h93i h94i h95i h96i h97i h98i h99i h100i h101i h102i h103i REFERENCES DEFVAR-INITIALIZATION:CONSERVATIVE 86 DESCRIBE-INTERACTIVE:EXPLICITLY-VAGUE 697 DESCRIBE-UNDERSPECIFIED:DESCRIBE-OBJECT 697, 698, 817, 840 DESTRUCTURING-BIND:NEW-MACRO 204, 207 DISASSEMBLE-SIDE-EFFECT:DO-NOT-INSTALL 682 DO-SYMBOLS-DUPLICATES:ALLOWED 274 DOTTED-MACRO-FORMS:ALLOW 74 DRIBBLE-TECHNIQUE:MAKE-EXPLICITLY-VAGUE 700 DYNAMIC-EXTENT:NEW-DECLARATION 232 DYNAMIC-EXTENT-FUNCTION:EXTEND 232 EQUAL-STRUCTURE:MAYBE-STATUS-QUO 107, 108 EVAL-OTHER:SELF-EVALUATE 70 EVAL-WHEN-NON-TOP-LEVEL:GENERALIZE-EVAL-NEW-KEYWORDS 89, 207 EXIT-EXTENT:MINIMAL 189 EXPT-RATIO:P.211 301 FIXNUM-NON-PORTABLE:TIGHTEN-DEFINITION 16, 39, 368, 446 FLET-DECLARATIONS:ALLOW 154 FLET-IMPLICIT-BLOCK:YES 63, 139, 143, 154, 196, 206 FLOAT-UNDERFLOW:ADD-CONTROLS 289, 369(2) FORMAT-ATSIGN-COLON:OK 582 FORMAT-COLON-UPARROW-SCOPE:TEST-FOR-REMAINING-SUBLISTS 606 FORMAT-COMMA-INTERVAL:YES 585 FORMAT-E-EXPONENT-SIGN:FORCE-SIGN 592 FORMAT-OP-C:WRITE-CHAR 588 FORMAT-PRETTY-PRINT:YES 583, 584(2), 585(2), 586(4), 588, 590, 592, 594, 596 FUNCTION-CALL-EVALUATION-ORDER:UNSPECIFIED 75 FUNCTION-COMPOSITION:JAN89-X3J13 391 FUNCTION-DEFINITION:JAN89-X3J13 682 FUNCTION-NAME:SMALL 84, 114, 116, 120(2), 123, 125(2), 126(2), 127, 128(3), 154, 227, 230(2), 677, 682, 695, 696, 699, 827, 842 FUNCTION-TYPE:X3J13-MARCH-88 14, 36, 38, 53, 65, 102, 116, 119, 120, 145, 146, 173, 203, 389, 391, 492, 503, 504 FUNCTION-TYPE-ARGUMENT-TYPE-SEMANTICS:RESTRICTIVE 58, 227, 228 FUNCTION-TYPE-KEY-NAME:SPECIFY-KEYWORD 57 FUNCTION-TYPE-REST-LIST-ELEMENT:USE-ACTUAL-ARGUMENT-TYPE 57 GENSYM-NAME-STICKINESS:LIKE-TEFLON 245, 246 GET-MACRO-CHARACTER-READTABLE:NIL-STANDARD 542, 548 GET-SETF-METHOD-ENVIRONMENT:ADD-ARG 137, 142, 144, 145(2) HASH-TABLE-ACCESS:X3J13-MAR-89 440 HASH-TABLE-PACKAGE-GENERATORS:ADD-WITH-WRAPPER 275, 439 HASH-TABLE-SIZE:INTENDED-ENTRIES 436, 437(2) HASH-TABLE-TESTS:ADD-EQUALP 437 IEEE-ATAN-BRANCH-CUT:SPLIT 302(2), 303, 306, 309, 310(2), 311 IMPORT-SETF-SYMBOL-PACKAGE:YES 268 IN-PACKAGE-FUNCTIONALITY:MAR89-X3J13 261, 263, 690 REFERENCES h104i h105i h106i h107i h108i h109i h110i h111i h112i h113i h114i h115i h116i h117i h118i h119i h120i h121i h122i h123i h124i h125i h126i h127i h128i h129i h130i h131i h132i h133i h134i h135i h136i h137i h138i h139i h140i IN-SYNTAX:MINIMAL 658, 679 KEYWORD-ARGUMENT-NAME-PACKAGE:ANY 76, 79 LAST-N:ALLOW-OPTIONAL-ARGUMENT 416 LCM-NO-ARGUMENTS:1 299 LISP-PACKAGE-NAME:COMMON-LISP 258, 262, 263(2), 278, 280 LISP-SYMBOL-REDEFINITION:MAR89-X3J13 260 LOAD-OBJECTS:MAKE-LOAD-FORM 659, 694 LOAD-TIME-EVAL:R**3-NEW-SPECIAL-FORM 73, 680 LOAD-TRUENAME:NEW-PATHNAME-VARIABLES 658(2), 659, 680(3) LOCALLY-TOP-LEVEL:SPECIAL-FORM 73, 90, 221 LOOP-AND-DISCREPANCY:NO-REITERATION 716 LOOP-FACILITY 163, 709 MACRO-CACHING:DISALLOW 203 MACRO-ENVIRONMENT-EXTENT:DYNAMIC 197, 203, 204 MACRO-FUNCTION-ENVIRONMENT:YES 194 MAKE-PACKAGE-USE-DEFAULT:IMPLEMENTATION-DEPENDENT 263, 271 MAP-INTO:ADD-FUNCTION 395 MAPPING-DESTRUCTIVE-INTERACTION:EXPLICITLY-VAGUE 169, 173, 178, 1061 275(3), 277, 395, 397, 398, 400, 401, 402, 403, 404(2), 405, 407(3), 409, 410, 413, 425(2), 426(3), 427, 429(2), 430, 431(2), 433, 434, 439(2), 491 MORE-CHARACTER-PROPOSAL 373(2), 374, 502, 504, 508, 646, 647, 651, 656 NTH-VALUE:ADD 184 OPTIMIZE-DEBUG-INFO:NEW-QUALITY 231 PACKAGE-CLUTTER:REDUCE 259 PACKAGE-DELETION:NEW-FUNCTION 264, 265 PACKAGE-FUNCTION-CONSISTENCY:MORE-PERMISSIVE 250, 264(3), 265(4), 267(3), 268(4), 269(3), 274, 275(2) PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT 617, 625, 641, 643, 644 PATHNAME-COMPONENT-VALUE:SPECIFY 615, 623 PATHNAME-LOGICAL:ADD 628, 639, 640, 641, 646, 652, 653, 654(2), 655(2), 658, 663, 678, 699(2) PATHNAME-PRINT-READ:SHARPSIGN-P 531, 537, 556 PATHNAME-STREAM:FILES-OR-SYNONYM 278, 638(2), 639, 640, 641, 644, 645, 646, 651, 653(2), 654, 655(2), 658, 663, 678 PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION 615, 617, 620, 644 PATHNAME-SYMBOL:NO 278, 637, 638, 639, 640, 641, 644, 645 PATHNAME-SYNTAX-ERROR-TIME:PATHNAME-CREATION 642, 643, 645 PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN 613 PATHNAME-WILD:NEW-FUNCTIONS 623, 639, 646, 652, 653, 654(2), 655(2), 658, 678 PEEK-CHAR-READ-CHAR-ECHO:FIRST-READ-CHAR 501, 570, 571, 573(2), 574 PRETTY-PRINT-INTERFACE:XP 24, 556, 559, 577, 578, 579, 598, 599, 605, 607, 748 PRINC-CHARACTER:WRITE-CHAR 578 1062 h141i h142i h143i h144i h145i h146i h147i h148i h149i h150i h151i h152i h153i h154i h155i h156i h157i h158i h159i h160i h161i h162i h163i h164i h165i h166i h167i h168i h169i h170i h171i h172i h173i h174i h175i h176i h177i h178i REFERENCES PRINT-CASE-PRINT-ESCAPE-INTERACTION:VERTICAL-BAR-RULE-NOUPCASE 552, 560 PRINT-CIRCLE-SHARED:RESPECT-PRINT-CIRCLE 559 PRINT-CIRCLE-STRUCTURE:USER-FUNCTIONS-WORK 480, 559 PROCLAIM-ETC-IN-COMPILE-FILE:NEW-MACRO 215, 223, 232, 689 PROCLAIM-INLINE-WHERE:BEFORE 229 PUSH-EVALUATION-ORDER:ITEM-FIRST 132, 242(2), 297, 420, 421, 672, 674(2) 422, 671, QUOTE-SEMANTICS:NO-COPYING 105, 115 RANGE-OF-COUNT-KEYWORD:NIL-OR-INTEGER 400(2), 403 RANGE-OF-START-AND-END-PARAMETERS:INTEGER-AND-INTEGER-NIL 390 READ-CASE-SENSITIVITY:READTABLE-KEYWORDS 11, 28, 513(2), 515, 549, 552, 561 REAL-NUMBER-TYPE:X3J13-MAR-89 15, 38, 49, 50, REDUCE-ARGUMENT-EXTRACTION:KEY 398 REMF-DESTRUCTION-UNSPECIFIED:X3J13-MAR-89 402, 404, 419, 420, 429(2), 431 61, 101 241(2), 242(2), 393, 401, REQUIRE-PATHNAME-DEFAULTS:ELIMINATE 277, 280, 637 REST-LIST-ALLOCATION:MAY-SHARE 77 RETURN-VALUES-UNSPECIFIED:SPECIFY 221, 263, 265, 278, 542, 696, 698 ROOM-DEFAULT-ARGUMENT:NEW-VALUE 699 SEQUENCE-TYPE-LENGTH:MUST-MATCH 64, 394, 395(2), 410 SETF-MULTIPLE-STORE-VARIABLES:ALLOW 129(2), 131(2), 672 SETF-SUB-METHODS:DELAYED-ACCESS-STORES 134 SHADOW-ALREADY-PRESENT:WORKS 269 SHARP-COMMA-CONFUSION:REMOVE 523, 535, 539, 676 SHARPSIGN-PLUS-MINUS-PACKAGE:KEYWORD 539, 707 SPECIAL-TYPE-SHADOWING:CLARIFY 222 STANDARD-INPUT-INITIAL-BINDING:DEFINED-CONTRACTS 499 STEP-ENVIRONMENT:CURRENT 696, 697 STREAM-ACCESS:ADD-TYPES-ACCESSORS 35, 41, 500(2), 501(4), 502(2), 503, 504, 505, 507, 581, 646 STREAM-CAPABILITIES:INTERACTIVE-STREAM-P 507 STRING-COERCION:MAKE-CONSISTENT 462(2), 463(2), 465, 466, 467 SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR 390 SUBTYPEP-TOO-VAGUE:CLARIFY-MORE 97 SYMBOL-MACROLET-DECLARE:ALLOW 155, 216, 861, 864 SYMBOL-MACROLET-SEMANTICS:SPECIAL-FORM 121, 122, 128, 155, 156, 204, 861, 864 SYNTACTIC-ENVIRONMENT-ACCESS:SMALL TAILP-NIL:T 427 TEST-NOT-IF-NOT:FLUSH-ALL 391 THE-AMBIGUITY:FOR-DECLARATION 237 TIME-ZONE-NON-INTEGER:ALLOW 703 207 184, REFERENCES h179i h180i h181i h182i h183i h184i h185i h186i TYPE-OF-UNDERCONSTRAINED:ADD-CONSTRAINTS 66 UNDEFINED-VARIABLES-AND-FUNCTIONS:COMPROMISE 71 UNREAD-CHAR-AFTER-PEEK-CHAR:DONT-ALLOW 573 VARIABLE-LIST-ASYMMETRY:SYMMETRIZE 150, 151, 164 WITH-COMPILATION-UNIT:NEW-MACRO 683 WITH-OPEN-FILE-DOES-NOT-EXIST:STREAM-IS-NIL 652 WITH-OUTPUT-TO-STRING-APPEND-STYLE:VECTOR-PUSH-EXTEND ZLOS-CONDITIONS:INTEGRATE 865, 883, 886, 900, 916 1063 504 Index 1064 Index of Constants 1065 Index of Functions 1066 Index of Generic Functions Index only generic functions, not primary methods (which are redundant| there is a generic function for every group of primary methods) 1067 Index of Loop Clauses 1068 Index of Macros 1069 Index of Special Forms 1070 Index of Variables Don't have a separate index for types or classes 1071 Colophon Camera-ready copy for this book was created by the author (using TEX, LaTEX, and TEX macros written by the author), proofed on an Apple LaserWriter II, and printed on a Linotron 300 at Advanced Computer Graphics The text of the rst edition was converted from Scribe format to TEX format by a throwaway program written in Common Lisp The diagrams in chapter 12 were generated automatically as PostScript code (by a program written in Common Lisp) and integrated into the text by Textures, an implementation of TEX by Blue Sky Research for the Apple Macintosh computer The body type is 10-point Times Roman Chapter titles are in ITC Eras Demi running heads and chapter subtitles are in ITC Eras Book The monospace typeface used for program code in both displays and running text is 8.5-point Letter Gothic Bold, somewhat modi ed by the author through TEX macros for improved legibility The accent grave (`), accent acute('), circum ex (^), and tilde (~) characters are in 10-point Letter Gothic Bold and adjusted vertically to match the height of the 8.5-point characters The hyphen (-) was replaced by an en dash (-) The equals sign (=) was replaced by a construction of two em dashes (UU), one raised and one lowered, the better to match the other relational characters The sharp sign (#) is overstruck with two hyphens, one raised and one lowered, to eliminate the vertical gap (# ) Special mathematical characters such as square-root signs are in Computer Modern Math The typefaces used in this book were digitized by Adobe Systems Incorporated, except for Computer Modern Math, which was designed by Donald E Knuth 1072 ... 1984 de nition and to the language as modi ed by the actions of X3J13 It contains the entire text of the rst edition of Common Lisp: The Language, with corrections and minor editorial changes however,... endorse the nal design reported here), but their pointed criticisms were just as important to the polishing of Common Lisp as all the positively phrased suggestions All of the people named above... X3J13 Votes Other Indexes 1064 1058 xii CONTENTS Preface SECOND EDITION Common Lisp has succeeded Since publication of the rst edition of this book in 1984, many implementors have used it as a de