The Road to Perspective Are Often Badly Covered, If at All
Total Page:16
File Type:pdf, Size:1020Kb
Coding with Lisp Coding with Lisp Developing Lisp code on a free software platform is no mean feat, and documentation, though available, is dispersed and comparison to solid, hefty common tools such as gcc, often too concise for users new to Lisp. In the second part of gdb and associated autobuild suite. There’s a lot to get used to here, and the implementation should be an accessible guide to this fl exible language, self-confessed well bonded with an IDE such as GNU Emacs. SLIME is a contemporary solution which really does this job, Lisp newbie Martin Howse assesses practical issues and and we’ll check out some integration issues, and outline further sources of Emacs enlightenment. It’s all implementations under GNU/Linux about identifying best of breed components, outlining solutions to common problems and setting the new user on the right course, so as to promote further growth. And as users do develop, further questions inevitably crop up, questions which online documentation is poorly equipped to handle. Packages and packaging from both a user and developer The Road To perspective are often badly covered, if at all. And whereas, in the world of C, everyday libraries are easy to identify, under Common Lisp this is far from the case. Efforts such as key SBCL (Steel Bank Common Lisp) developer and all round good Lisp guy, Dan Barlow’s cirCLe project, which aimed to neatly package implementation, IDE, documentation, libraries and packagingpackaging ttools,ools, wouldwould ccertainlyertainly mmakeake llifeife eeasierasier forfor tthehe nnewbie,ewbie, bbutut Graphical Common OpenMCL all play well here, with work in Lisp IDEs are a rare unfortunatelyunfortunately progressprogress doesdoes sseemeem ttoo hhaveave slowedslowed onon thisthis ffront.ront. thing these days, progress on CLISP.CLISP. Other key issues in assessing and Jabberwocky Lisps include the availability of functional does pack in the MANY WORLDS features if you prefer libraries, deliverydelivery of executables and the nature WithoutWithout even throwing Scheme, a distinct dialect of Lisp, into the a GUI management of compilation. The last is a tricky topic which and coding approach mix, and scarcelyscarcely scratching the surfacesurface of smallersmaller,, more embeddable involves some digging deep into how such Lisps Lisp custom Lisps, the terrain of free implementations is vast and few work. However,However, although such technical issues Garnet is certainly easier to swallow than maps exist to readily guide the newbie. Free Common Lisps include do have some bearing, choosing an appropriate “Generating an the exotically titled Armed Bear Lisp, CLISP,CLISP, a pleasant interactive Lisp, Lisp is a lot more about style and fl avour,avour, with Amalgam of Real-time, Novel Editors and isp is as esoteric as it is powerful, and coding is truly GCL, the offi cial GNU Common Lisp and the two big hitters CMUCL factors such as verbosity and ease of re-entering Toolkits,” and in the only route to mastering the intricacies of this (CMU Common Lisp) and SBCL (Steel Bank Common Lisp). Other the REPL or top-level as major elements here. practise it does offer a versatile, well thought Lcomplex and supremely intriguing language and the free Lisps of note include the cool and veryvery powerfulpowerful OpenMCL, Under GNU/Linux on an x86 architecture,architecture, out GUI toolkit rapid development model presented by its REPL (Read Eval which runs on a PPC architecturearchitecture under LinuxPPC or Darwin,Darwin, and in CMUCL and SBCL really are the major players, Print Loop) or top-level. Lisp masters well earn the title of the latter instance includes bindings to Cocoa and Carbon, which garnering most respect from the community.community. It’sIt’s wizards, and it’s no coincidence that Abelson and Sussman makes for elegant application building. VariousVarious comparative sursurveysveys also worth mentioning that SBCL now offers 64 refer to casting spells with Lisp, a common metaphor have been made of these major free Lisps, with the ubiquitous bit support for the AMD64 and EM64T within the community and modifi ed title of a popular cliki.net resourceresource providing at-a-glance tables surveyingsurveying the terrain as platforms. CLISP is well worth keeping in reserve,reserve, beginner’s tutorial at lisperati.com. to features, ANSI compliance and performanceperformance across a good range however,however, with good performanceperformance for some tasks, In the fi rst article in this series, the conceptual of benchmarks. Of course compliance is important, particularly if and readline providing an excellent level of underpinnings of Lisp were presented, giving a fl avour of you’re interested in coding portable applications across command line interaction. It’sIt’s a good, the language from a cultural and theoretical perspective. As implementations, but there are plenty for other issues which effect lightweight Lisp to fi re up at odd moments, an aside, before getting down to the real action of Lisp on the choice, particularly for new users. Once Lisp experience has been when you simply don’tdon’t need the burden of a a free software platform, it’s also worth stressing the gained, other fl avours can be checked out as it’sit’s obvious that some fully fl edged IDE. CLISP can even be used as a importance of Lisp to thinkers and mathematicians on the Lisps are better suited to particular projects. shell for those who like to see Lisp everywhere.everywhere. bleeding edge of theory, working artistically in what are Given that CMUCL and SBCL can readily be often considered wholly scientifi c fi elds. Douglas Hofstadter, viewed as brothers, forking from the same stock of GEB (Godel, Escher, Bach: An Eternal Golden Braid) fame provides an excellent It’s no coincidence that or code base, the choice between these high introduction to the playfully recursive aspects of Lisp in his rich and rewarding performance Lisps is something of a tough one, Metamagical Themas. And both Bruno Marchal and Gregory Chaitin, working in the boiling down to look and feel, and compatibility fi elds of consciousness theory and hardcore maths and computation respectively, have Abelson and Sussman with various libraries or research apps such as expressed huge interest in the elegance of Lisp. Aside from such lofty concerns which Common Music. Indeed, SBCL derives so much serve to fi re the thirst for Lisp, what we’re concerned with here is getting down and refer to casting spells with Lisp code from CMUCL, created at Carnegie Mellon dirty with some simple application or example code, say from Paul Graham’s excellent University, that save for the confusion such a ANSI Common Lisp, and such an enterprise demands a robust and readily navigable naming would cause, CMUCL has been mooted working environment. We’ll need to select from a plethora of free software Lisp (and Alongside portability, other pressing issues include the level of as an equally appropriate name for this vibrant dialects such as Scheme) implementations, choosing one which will readily suit a integration with a suitably powerful IDE. In this instance SLIME offshoot. In practise, SBCL’s rather ugly beginner, whilst still remaining open to others more suited to certain more demanding (Superior Lisp Interaction Mode for Emacs) has been chosen as best of expansion into Steel Bank Common Lisp is an users and applications. Some free software Lisps can seem brittle and over-verbose in breed component which fi ts the bill here, and CMUCL, SBCL, and acknowledgement of the industries where 28 LinuxUser & Developer LinuxUser & Developer 29 Coding with Lisp Coding with Lisp Andrew Carnegie and Andrew Mellon, with functions such as compile-fi le. SBCL takes a similar approach, EINE, ZWEI respectively, made the money. The name also but cuts out the middleman. In both instances, the speed of a Lisp can well be developed following the edit-compile-test cycle of well refers to the heavyweight, industry-strength compiled language is proffered with all the development benefi ts of languages such as C, with, for example, an editor providing qualities of this powerful Lisp, and though interactive interpretation. It’s a win win situation. In common with indentation, highlighting and shell access, and any of the Lisps under favoured by hardcore free software hackers on CMUCL, SBCL offers a low level, basic interpreter for easy forms. consideration compiling to native code for debugging. However, as the Lisp scene, such as key developer Dan More complex stuff is thrown straight at the native compiler. Of we’ve seen in the last issue, the beauty of Lisp lies in supreme Barlow, SBCL lives up to the tough, heavy course it’s all still totally interactive, and compiled-function-p is our interaction, with on-the-fl y bugfi xes a distinct possibility. The REPL handed, somewhat ugly inspiration of its name. only clue that we’re not dealing strictly with an interpreter. provides for this interaction in theory, but in practise an IDE which That said, SBCL does expose a decent feature set SBCL does present a more attractive package given its more active integrates with this functionality and extends it radically is very much with native threads as a major bonus, but most development model, which means that libraries and build systems are in order for this complex language. Such an IDE should free the coder differences between the two siblings lie under well packaged for it. The ASDF package management system, though from banal concerns with syntax and numerous shortcuts should ease the bonnet and relate to the differing now ported to CMUCL, was originally an SBCL only affair, and repetitive actions and provide for fl exible, customised development development models of both Lisps. packaging of asdf-install does refl ect this.