Basic Lisp Techniques

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

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

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

资源描述

BasicLispTechniquesDavidJ.Cooper,Jr.October10,2000ii0Copyrightc2000,FranzInc.andDavidJ.Cooper,Jr.Foreword1Computers,andthesoftwareapplicationsthatpowerthem,permeateeveryfacetofourdailylives.Fromgroceriestoairlinereservationstodentalappointments,ourrelianceontechnologyisall-encompassing.And,wewantmore.Everyday,ourexpectationsoftechnologyandsoftwareincrease:smallercellphonesthatsurfthenetbettersearchenginesthatgenerateinformationweactuallywantvoice-activatedlaptopscarsthatknowexactlywheretogoThelistisendless.Unfortunately,thereisnotanendlesssupplyofprogrammersanddeveloperstosatisfyourinsatiableappetitesfornewfeaturesandgadgets.\Cheaptalenttohelpcompletethe\gruntworkofanapplicationnolongerexists.Further,thedaysofunlimitedfundingareover.Investorswanttoseeresults,fast.Everyday,hundredsofmagazineandon-linearticlesfocusonthetimeandpeopleresourcesneededtosupportfuturetechnologicalexpectations.CommonLisp(CL)isoneofthefewlanguagesanddevelopmentoptionsthatcanmeetthesechallenges.Powerful,exible,changeableonthey|increasingly,CLisplayingaleadingroleinareaswithcomplexproblem-solvingdemands.Engineersinthe eldsofbioinformatics,scheduling,datamining,documentmanagement,B2B,andE-commercehaveallturnedtoCLtocompletetheirapplicationsontimeandwithinbudget.ButCLisnolongerjustappropriateforthemostcomplexproblems.Applicationsofmodestcomplexity,butwithdemandingneedsforfastdevelopmentcyclesandcustomization,arealsoidealcandidatesforCL.OtherlanguageshavetriedtomimicCL,withlimitedsuccess.Perl,Python,Java,C++,C#|theyallincorporatesomeofthefeaturesthatgiveLispitspower,buttheirimplementationstendtobebrittle.ThepurposeofthisbookistoshowcasethefeaturesthatmakeCLsomuchbetterthantheseimitators,andtogiveyoua\quick-startguideforusingCommonLispasadevelopmentenvironment.IfyouareanexperiencedprogrammerinlanguagesotherthanLisp,thisguidegivesyouallthetoolsyouneedtobeginwritingLispapplications.Ifyou'vehadsomeexposuretoLispinthepast,thisguidewillhelprefreshthosememoriesandshedsomenewlightonCLforyou.1thisForewordwasauthoredbyFranzInc.iiiivButbecareful,Lispcanbeaddicting!ThisiswhymanyFortune500companieswillusenothingelseontheir24/7,cutting-edge,mission-criticalapplications.Afterreadingthisbook,tryingoursoftware,andexperiencinga3to10timesincreaseinproductivity,webelieveyouwillfeelthesameway.Contents1Introduction11.1ThePast,Present,andFutureofCommonLisp................11.1.1LispYesterday..............................11.1.2LispToday................................11.1.3LispTomorrow..............................21.2ConvergenceofHardwareandSoftware....................31.3TheCLModelofComputation.........................32OperatingaCLDevelopmentEnvironment52.1InstallingaCLEnvironment..........................52.2RunningCLinaShellWindow.........................62.2.1StartingCLfromaTerminalWindow.................62.2.2StoppingCLfromaTerminalWindow.................62.3RunningCLinsideaTextEditor........................82.3.1ANoteonEmacsandTextEditors...................82.3.2EmacsTerminology...........................82.3.3Starting,Stopping,andWorkingWithCLinsideanEmacsShell..92.4RunningCLasasubprocessofEmacs.....................102.4.1StartingtheCLsubprocesswithinEmacs...............102.4.2WorkingwithCLasanEmacssubprocess...............112.4.3CompilingandLoadingaFilefromanEmacsbu er.........122.5IntegratedDevelopmentEnvironment.....................132.6TheUserInitFile................................132.7UsingCLasascriptinglanguage........................142.8DebugginginCL.................................152.8.1Commondebuggercommands......................152.8.2InterpretedvsCompiledCode.....................162.8.3Useof(break)andC-ctointerrupt...................162.8.4Pro ling..................................172.9DevelopingProgramsandApplicationsinCL.................172.9.1ALayeredApproach...........................172.9.2CompilingandLoadingyourProject..................172.9.3CreatinganApplication\FaslFile..................182.9.4CreatinganImageFile.........................19vviCONTENTS2.9.5BuildingRuntimeImages........................192.9.6UsinganApplicationInitFile......................192.10UsingCLwithOtherLanguagesandEnvironments..............202.10.1InterfacingwiththeOperatingSystem.................202.10.2ForeignFunctionInterface........................202.10.3InterfacingwithCorba..........................212.10.4CustomSocketConnections.......................212.10.5InterfacingwithWindows(COM,DLL,DDE)............212.10.6CodeGenerationintoOtherLanguages................233TheCLLanguage253.1OverviewofCLanditsSyntax.........................253.1.1EvaluationofArgumentstoaFunction................273.1.2LispSyntaxSimplicity..........................273.1.3TurningO Evaluation.........................283.1.4FundamentalCLDataTypes......................293.1.5Functions.................................313.1.6GlobalandLocalVariables.......................323.2TheListasaDataStructure..........................343.2.1AccessingtheElementsofaList....................353.2.2Th

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

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

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

×
保存成功