1. 首页
  2. 编程语言
  3. 其他
  4. Common Lisp Recipes

Common Lisp Recipes

上传者: 2019-07-09 10:24:50上传 PDF文件 8.95MB 热度 38次
Common Lisp Recipes is a collection of solutions to problems and answers to questions you are likely to encounter when writing real-world applications in Common Lisp. Written by an author who has used Common Lisp in many successful commercial projects over more than a decade, this book is the first Common Lisp Recipes: A Problem-Solution ApproachEdmund weitzHamburg germanyISBN13(pbk):978-1-4842-1177-9ISBN-13( electronic:978-1-4842-1176-2DOI:10.1007/978-1-4842-1176-2Library of Congress Control Number: 2015960959Copyright o 2016 by Edmund WeitzThis work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of thematerial is concerned, specifically the rights of translation, reprinting, reuse ofillustrations, recitation,broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storageand retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known orhereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews orscholarly analysis or material supplied specifically for the purpose of being entered and executed on a computersystem, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof ispermitted only under the provisions of the Copyright Law of the Publishers location, in its current version, andpermission for use must always be obtained from Springer. Permissions for use may be obtained throughRightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respectiveCopyright LawTrademarked names, logos, and images may appear in this book. Rather than use a trademark symbol withevery occurrence of a trademarked name, logo, or image we use the names, logos, and images only in aneditorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademarkhe use in this publication of trade names, trademarks, service marks, and similar terms, even if they are notidentified as such, is not to be taken as an expression of opinion as to whether or not they are subject toproprietary rightsWhile the advice and information in this book are believed to be true and accurate at the date of publication,neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors oromissions that may be made. The publisher makes no warranty, express or implied, with respect to the materialcontained hereinManaging Director: Welmoed SpahrLead Editor: Steve anglinTechnical reviewer: Hans hubnerEditorial Board: Steve Anglin, Louise Corrigan, Jonathan Gennick, Robert Hutchinson, Michelle Lowman,James Markham, Susan McDermott, Matthew Moodie, Jeffrey Pepper, Douglas PundickBen Renow-Clarke, Gwenan Spearing, Steve WeissCoordinating Editor: Mark PowersCopy Editor: Kimberly burton-WeismanCompositor: SPi globalIndexer: SPi GlobalArtist: SPi GlobalDistributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street,6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax(201)348-4505e-mailorders-nyospringer-sbm.comorvisitwww.springeronline.comApressMedia,LlcisaCaliforniaLlcand the sole member(owner) is Springer Science+ Business Media Finance Inc(SSBM Finance Inc). SSBMFinance Inc is a Delaware corporationForinformationontranslationspleasee-mailrights@apress.com,orvisitwww.apress.comApress and friends of ed books may be purchased in bulk for academic, corporate, or promotional use e Bookversions and licenses are also available for most titles. For more information, reference our Special bulkSales-ebookLicensingwebpageatwww.apress.com/bulk-salesAny source code or other supplementary materials referenced by the author in this text is available to readers atwww.apress.com/9781484211779.Fordetailedinformationabouthowtolocateyourbookssourcecodegotowww.apress.com/source-code/.ReaderscanalsoaccesssourcecodeatSpringerlinkintheSupplementaMaterial section for each chapterPrinted on acid-free paperwww.it-ebooks.infoFor heike and mounawww.it-ebooks.infoTable of contentsabout the authorXVILabout the Technical reviewerXⅨXPrefaceXXIWho This book is forXXIWho This Book Is(Probably)Not ForXX∏How to read This bookXXIIWhat's In and what not.,,,,,,,,,,,.XXTIThe hyperspecXXIVWhich ImplementationSource codeXXVThe IndexXXVTypographical conventionsXXVAcknowledgements1. Symbols and Packages1-1. Understanding the role of packages and the symbol nomenclature. 11-2. Making unique symbols1-3. Making Symbols InaccessibleHow Can We Fix This?1-4. Avoiding Name Conflicts12When Name Conflicts do Not occur151-5. Using Symbols as stand-Ins for Arbitrary forms151-6. Searching for Symbols by Name171-7. Iterating Through All Symbols of a Package19What To Do If You don t Like loop201-8. Understanding COMMON LISP's Case(In)Sensitivity21Style hint: Dont Use CamelCase!251-9. Using Symbols As String Substitutes26So, what Should You use?271-10."Overloading"of Standard COMMON LISP Operators282. Conses, Lists, and trees312-1. Understanding Conses31List ace34Testing Whether Something Is a Cons or a list3522. Creating Lists..·37Converting Vectors to Lists382-3. Transposing a Matrix39www.it-ebooks.infoTable of contents2-4. USing List Interpolation2-5. Adding Objects to the End of a List42The Tail Wagging the list442-6. Splicing" into a List452-7. Detecting Shared Structure in Lists49Isolating the Non-Shared Part512-8orking with Trees.51More Complicated Trees54COMMON LISP'S Standard Tree Functions552-9. Working with Stacks552-10. Implementing a queue562-11. Destructuring and Pattern Matching583. Strings and Characters..613-1. Getting the asCll Code of a characterThe Other Way around..,,63The limit633-2. Naming Characters633-3. USing Different Character Encodings653-4. Comparing strings or Characters.,.,67Internationalization703-5. Escaping Characters in String Literals and Variable InterpolationIs It still a literal?723-6. Controlling caseWhat about Unicode?743-7. Accessing or Modifying a Substring.753-8. Finding a Character or a Substring Within a String773-9. Trimming strings773-10. Processing a string one character at a time793-11. Joining Strings813-12. Reading csv Data4. Numbers and math874-1. USing Arbitrarily Large Integers....874-2. Understanding Fixnums894-3. Performing Modular Arithmetic92Efficiency Considerations4-4. Switching Bases944-5. Performing Exact Arithmetic with Rational numbers96Various Ways of Converting Numbers to IntegersHow Not to use floor and friendsConverting Floating-Point Numbers to Rationals and Vice Versa 99Mixing rationals and Floats....1014-6. Controlling the Default Float Format1024-7. Employing arbitrary precision Floats1044-8. Working with Complex numbers106www.it-ebooks.infoTable of contents4-9. Parsing numbers4-10. Testing Whether Two Numbers Are Equal.111Dont Ever use eQ with Numbers!1124-11. Computing Angles Correctly.1134-12. Calculating exact Square roots1155. Arrays and Vectors1175-1. Working with Multiple Dimensions1175-2. Understanding vectors and Simple arrays..,.1195-3. Obtaining the Size of an Array.1205-4. Providing Initial Contents121A Warning About Identical Objects122Treating Arrays As Vectors123Making the length of vectors Flexible1255-7. Adjusting arrays1275-8. USing an Array As a" Windowinto Another Array1295-9. Restricting the Element Type of an array.131Upgrading Element Types1335-10. Copying an array134A Warning About Object Identity1356. Hash Tables, maps, and sets1376-1. Understanding the Basics of Hash Tables137Why Does GETHASH Return Two values139How Many Entries does the hash Table have?1406-2. Providing Default Values For Hash Table Lookups1406-3. Removing Hash Table entries.1426-4. Iterating Through a Hash Table.143Dont rely on any order146Don't Modify While You're Iterating147Cant This be more concise, please?1476-5. Understanding hash Table Tests and defining your own148What Is sXhash For?1526-6. Controlling Hash Table growth1526-7. Getting Rid of Hash Table Entries Automatically.1556-8. Representing Maps As Association Lists158Combining Lookup and manipulation161Why Would Anybody Prefer Alists over Hash Tables? .... 1626-9. Representing Maps As Property Lists163When to Prefer plists over Alists165The plist of a Symbol1666-10. Working with Sets166Representing sets As hash Tables169Representing sets as Bit Patterns1697. Sequences and iteration.1717-1. Filtering a Sequence.....171www.it-ebooks.infoTable of contents7-2. Searching a Sequence.1727-3. Sorting and Merging Sequences1757-4. Mixing Different Sequence Types.1777-5. Re-USing a Part of a Sequence..1777-6. Repeating some values cyclically.179Alternatives,...1817-7. Counting down....1827-8. Iterating over" Chunks"of a List.1847-9. Closing over Iteration Variables1867-10."Extending" Short Sequences in Iterations1877-11. Breaking out of LOOP1887-12. Making sense of the MAP... ZoThe Sequence variants.1947-13. Defining Your Own Sequence Types....1947-14. Iterating with ITERATE1967-15. Iterating with SERIES200What the Example does2018. The Lisp reade2038-1. Employing the Lisp reader for Your Own Code203Why read Is potentially dangerous205What rEAD Doesnt Do205The Optional arguments to READ206Go Wild!2068-2. Troubleshooting Literal Object Notation.206This also Applies to Strings.2088-3. Evaluating Forms at Read Time208What to look out for210Alternatives..2108-4. Embedding literal arrays into Your Code.,,.211The Usual Warning.2128-5. Understanding the Different Ways to Refer to a Function....... 2138-6. Repeating Something You already Typed.,,214They Dont Only Look Identical, They Are Identical2168-7. Safely Experimenting with readtables.216Temporarily switching to Standard Io Syntax.2188-8. Changing the Syntax Type of a Character.,..219The Six Syntax Types220How to Actually Change the Syntax Type222Some Things Never Change2228-9. Creating Your Own Reader macros223What Reader macro functions do2248-10. Working with Dispatching Macro Characters2268-11. Preserving Whitespace228www.it-ebooks.infoTable of contentsIting2319-1. Using the printing primitives231Printing Objects So That They Can Be read Back in Again235Shortcuts2369-2. Printing to and into Strings2379-3. Printing NIL as a list2399-4. Extending FORMAT Control Strings Over More Than One line2409-5. USing Functions As FORMAT Controls2419-6. Creating Your Own FORMaT Directives.2439-7. Recursive Processing of FORMAT Controls2459-8. Controlling How Your Own Objects Are Printed.2479-9. Controlling the Pretty Printer2499-10. Printing Long lists2539-11. Pretty-Printing Compound objects257Using the Pretty printer from FORMAt2609-12. Modifying the Pretty Printer.26210. Evaluation, Compilation, Control Flow26510-1. Comparing Arbitrary Lisp Objects.265Comparing State26Constants26910-2. Using Constant Variables as Keys in CASE Macros26910-3. Using Arbitrary Variable Names for Keyword Parameters ..... 271Keyword Names Don t have to be Keywords272Keyword Dames Dont have to Be Constant27310-4. Creating"Static Local Variables, "Like in C27310-5.Preponing the Computation of values27510-6. Modifying the behavior of functions You dont Have the Source of 27810-7. Swapping the values of Variables(or Places10-8. Creating Your Own \rte Forms for"Phgt∵…280283Using DEFSETF285Using DEFINE-SETF-EXPANDER286So, Which one do i use?291Using DEFINE-MODIFY-MACRO.291Multiple-valued places29310-9. Working with Environments29410-10. Commenting Out Parts of Your CodeSome notes about and#302How; #I, and Others are lmplemented30211. Concurrency30311-1. Managing Lisp Processes.304Escape Hatches307Threads Are expensive3081-2. Accessing Shared Resources Concurrently.308Locks.312Xwww.it-ebooks.infoTable of contentsAtomic Operations.313More problems31411-3. Using Special Variables in Concurrent Programs.317Per-Thread Initial Bindings..319Variables That Are Always Globa...31911-4. Communicating with Other Threads320Alternatives11-5. Parallelizing Algorithms Without Threads and Locks322322What the Example does325Fine-Tuning326Trees326Alternatives33011-6. Determining the Number of Cores33012. Error Handling and Avoidance33312-1. Checking Types at Run Time333Alternatiⅴes33512-2. Adding assertions to Your Code336Disabling Assertions in"Production Code33812-3. Defining Your Own Conditions.,..338How Conditions are printed34012-4. Signaling a condition.341Condition designators34312-5. Handling Conditions344Ignoring errors.34912-6. Providing and Using Restarts350Visible restarts354Predefined restarts35512-7. Getting Rid of Warning Messages..35612-8. Protecting Code from Non-Local Exits357WITH-Macros.36013. Objects, Classes, Types36113-1. Defining Types.,..361Compound Type specifiers363Derived Types.36513-2. Using Classes As Types.36613-3. Writing Methods for Built-In Classes36713-4. Providing Constructors for Your Classes36913-5. Marking Slots As"Private37213-6. Changing the Argument Precedence Order..37413-7. Automatically Initializing Slots on First Usage..37613-8. Changing and Redefining Classes on the Fly377Objects Changing Their Class380Redefining CIasses38113-9. Making Your Objects Externalizable383www.it-ebooks.info
下载地址
用户评论
码姐姐匿名网友 2019-07-09 10:24:50

lisp 的好资源不多呀

码姐姐匿名网友 2019-07-09 10:24:50

么得,好人,感谢分享!