Symbolic Programming using Common Lisp

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

SymbolicprogrammingusingCommonLispRobertStrandhcompiledbyLoicLacomme,October25,2000Contents1.Introduction32.WhyweuseCommonLisp42.1.Introduction...................................42.2.Theindustryargument.............................42.2.1.Theargument..............................42.2.2.Therefutation.............................42.3.Thereadabilityargument...........................52.3.1.Theargument..............................52.3.2.Therefutation.............................52.4.Theefficiencyargument............................52.4.1.Theargument..............................52.4.2.Therefutation.............................52.5.Thegraphicsargument.............................62.5.1.Theargument..............................62.5.2.Therefutation.............................63.Whatisaninterpretedlanguage?74.DifferencesbetweenSchemeandCommonLisp84.1.Sizeofthelanguage..............................84.2.Numbers.....................................84.3.Tailcalloptimization..............................84.4.Program/dataequivalence...........................94.5.Multiplenamespaces..............................94.6.Minorvariationsinsyntax...........................105.Thepsychologyoflearning116.Syntaxofprogramminglanguages146.1.Possibledefinitionsofsyntax.........................146.2.SyntaxinCommonLisp............................147.Autonomousfunctions168.Side-effectfreefunctions1729.IndentingCommonLisp189.1.Introduction...................................189.2.Generalrules..................................189.2.1.Top-levelfunctions...........................189.2.2.Closingparentheses..........................189.2.3.Amountofindentation.........................199.3.Comments....................................199.3.1.Numberofsemicolons.........................199.3.2.Contentofcomments.........................209.4.Indentingspecialforms.............................209.4.1.Indentingtheifspecialform......................209.4.2.Indentingthewhenandunlessspecialforms.............219.4.3.Indentingtheletandlet*specialforms...............219.4.4.Indentingthedoanddo*specialforms...............2110.Top-downprogramming2310.1.Disadvantagesoftop-downprogramming...................2310.2.Howdoestop-downprogrammingwork?...................2311.Bottom-upprogramming2411.1.Whatisbottom-upprogramming.......................2411.2.Advantagesofbottom-upprogramming...................2411.3.Howdoesbottom-upprogrammingwork?..................2412.Buildingspecializedlanguages2613.Object-orientedprogramming2713.1.Introduction...................................2713.2.Generalterminology..............................2713.2.1.Object..................................2713.2.2.Abstractdatatype...........................2713.2.3.Operation................................2813.2.4.Protocol.................................2813.2.5.Class...................................2813.2.6.Inheritance...............................2813.3.Object-orientedprogramminginCLOS....................2813.3.1.Method.................................2813.3.2.Genericfunctions............................2913.3.3.Genericdispatch............................2913.3.4.Multipleinheritance..........................2913.4.Object-orientedprogramminginJavaandotherlanguages.........2913.4.1.Statictyping..............................2913.4.2.Restrictionsonoperations.......................2913.4.3.Singleormultipleinheritance.....................3031.IntroductionInthisdocument,wedescribesymbolicprogrammingtechniquesusingtheCommonLisplanguage.Thereareanumberofchapters.Werecommendyoureadtheminthisorder:1.WhyCommonLisp.ThereasonuseCommonLisp.2.Interpretedlanguages.Twoplausibledefinitionsof“interpretedlanguage”andwhyCommonLispisnotmoreinterpretedthanotherlanguages.3.DifferencewithrespecttoScheme.ForthosewhoknowtheSchemelanguage,alistofthemajordifferencesbetweenSchemeandCommonLisp.4.Thepsychologyoflearning.Anexplanationtoanobservedphenomenonthatmanypeopledonotwanttolearnnewthings.5.Programminglanguagesyntax.CommonLisphasatwo-levelsyntax.Weexplainwhatthatmeans,andwhyitiscrucial.6.Autonomousfunctions.Wedefinewhatanautonomousfunctionis,andwhyitisgoodtowriteautonomousfunctions.7.Side-effectfreefunctions.Wedefinewhataside-effectfreefunctionis,andwhyitisgoodtowriteside-effectfreefunctions.8.IndentationofCommonLisp.ProgrammersofCommonLisphaveanagreementonhowtoformatandindentcode.Hereisasummaryoftherules.9.Top-downprogramming.Whytop-downprogrammingisusuallynotwhatyouwant.10.Bottom-upprogramming.Whybottom-upprogrammingisusuallywhatyouwant.11.Buildingspecializedlanguages.Aprogrammingtechniquethatiswelladaptedtoprogrammaintenance.12.Object-orientedprogramming.Fundamentalterminologyofobject-orientedpro-grammingandhowitappliestoCommonLispandotherlanguages.Thereisalsoaglossary.42.WhyweuseCommonLisp2.1.IntroductionManystudentsaskthequestionwhyweuseCommonLispinteachingprogramming.Here,wetrytoanswerthatquestion.TherearemanyreasonsforstudentstoquestionthechoiceofCommonLisp.Wethereforestructurethissectionarounddifferentreasonsstudentsgive

1 / 34
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功