ubuntu下commonlisp配置

鄢子平
2023-12-01


ubuntu 12.04 Commonlisp实现

ubuntu 12.04 commonlisp的实现很多,有clisp gclsbcl三个。你可以按照自己的需求安装对于的实现。我安装的是sbcl。这三个实现都可以通过softwareCenter 安装。如果你使用的是Windows,我建议还是使用lispbox网址http://common-lisp.net/project/lispbox/下载解压即可运行了。不需要关注各个软件的安装。

什么是CommonLisp

在讲解一样东西前先对它进行一番介绍是个好习惯,所以本文的第一个内容便是对CommonLisp的介绍。

CommonLisp是一中编程语言,它是Lisp的诸多方言中的一种。

Lisp的原始写法似乎应该是LISP,即LIStProcessor的缩写,不过Lisp这种写法似乎比LISP更常见(而且,在我看来,也更可爱= =)。LispJohnMcCarthy1960年左右创造的一种基于λ演算的函数式编程语言,可以说是历史悠久、源远流长(其古老程度和FORTRAN老哥有一拼)。当然在初期由于没有什么统一的规范或者标准,不同的人采用了不同的方式对Lisp进行实现,也就出现了许多方言,CommonLisp便是其中一种(另一个主要的Lisp方言是Scheme,此外还有一个和Emacs一起的EmacsLisp)。


Common Lisp实现区别和介绍

Common-lisp的实现有很多,下面我介绍几种。

CLISP
GNU CLISP, a Common Lisp implementation Common Lisp is a high-level,general-purpose programming language.A bytecode-compilingimplementation, portable and runs on a number of Unix and Unix-likesystems (including MacOS X), as well as Microsoft Windows and several other systems.GPL license. GNU CLISP is a Common Lisp implementation by BrunoHaible of Karlsruhe University and Michael Stoll of MunichUniversity, both in Germany. It mostly supports the Lisp describedin the ANSI Common Lisp standard. It runs on microcomputers (OS /2,Windows NT/2000, Windows 95/98, Amiga 500-4000, Acorn RISC PC) aswell as on Unix workstations (Linux, SVR4, Sun4, DEC Alpha OSF,HP-UX, BeOS, NeXTstep, SGI, AIX, Sun3 and others) and needs only 2MB of RAM. The user interface comes in German, English, French,Spanish and Dutch. GNU CLISP includes an interpreter,a compiler, a large subset of CLOS, a foreign languageinterface and a socket interface. An X11 interface is availablethrough CLX and Garnet.
GNU CLISP 后来贡献给了gnu 项目,所以叫做GNUCLISP GNUCLISP 实现包括解释器,编译器,CLOS 的大部分子集,以及外部语言接口和socket 接口。

GNU CommonLisp (GCL) 
The GNU Project'sLisp compiler. It producesnative object code by first generating Ccode and then calling a C compiler. Not yet fully ANSI-compliant,GCL is however the implementation of choice for several largeprojects including the mathematical tools Maxima, AXIOM and(historically) ACL2.GCL runs on Linuxunder eleven different architectures, and also under Windows,Solaris, and FreeBSD.GPL license.
GCL 是一个Lisp 编译器。它首先根据lisp 代码生成c 代码之后调用c 编译器生成机器代码。只是实现了大部分ansicommon lisp 标准。

Clozure CL(CCL) 
Clozure CL (CCL) is a CommonLisp implementation. It implements the full ANSI Common Lispstandard with several extensions (CLOS MOP, threads, CLOSconditions, CLOS streams, ...). It contains a command linedevelopment environment, an experimental integrated developmentenvironment (IDE) for Mac OS X using the Hemlockeditor, and can also be used with SLIME(a Common Lisp development environment for GNUEmacs). Clozure CL is opensource and the project is hosted by Clozure Associates.
Originally a freeand open source fork of Macintosh Common Lisp. As that historyimplies, CCL was written for the Macintosh, but Clozure CL now runson Mac OS X, FreeBSD, Linux, Solarisand Windows.32 and 64 bit x86ports are supported on each platform. Additionally there are PowerPC ports for Mac OS and Linux. CCL was previously known as OpenMCL,but that name is no longer used, to avoid confusion with the opensource version of Macintosh Common Lisp. LGPL license.
Clozure CL (CCL) 完全实现了ANSICommon Lisp 标准和某些重要的扩展。它包含一个命令行的开发环境和一个集成的ide ,可以使用hemlock editor 或者emacs 。最初由Macintosh Common Lisp 分化而来。
CMUCL
Originally from CarnegieMellon University, now maintained as freeand open source software by a group of volunteers. CMUCL uses afast native-code compiler. It is available on Linuxand BSDfor Intel x86; Linuxfor Alpha; Mac OS Xfor Intel x86 and PowerPC; and Solaris, IRIX, and HP-UX on theirnative platforms. Public domain (some parts BSD license) SteelBank Common Lisp is derived from CMUCL. The ScieneerCommon Lisp is a commercial derivative from CMUCL.

SteelBank Common Lisp (SBCL) 
A branch from CMUCL."Broadly speaking, SBCL is distinguished from CMU CL by agreater emphasis on maintainability." [10]SBCL runs on the platforms CMUCL does, except HP/UX; in addition, itruns on Linux for AMD64, PowerPC, SPARC, MIPS, Windows x86 [11]and has experimental support for running on Windows AMD64. SBCL doesnot use an interpreter by default; all expressions are compiled tonative code unless the user switches the interpreter on. The SBCLcompiler generates fast native code. [12]Public domain (some parts BSD license).
Steel Bank Common Lisp ( SBCL) is a free Common Lispimplementation that features a high performance native compiler, Unicode supportand threading.

The name "Steel Bank Common Lisp" is a reference toCarnegie MellonUniversity Common Lisp from which SBCL forked: AndrewCarnegie made his fortune in the steel industry and AndrewMellon was a successful banker.



上面只是介绍lisp最受关注的几个开源实现,lisp还有许多商用的实现比如说AllegroCommon LispLispWorks等,都提供了很好的集成IDE开发环境。

具体可以参阅:http://en.wikipedia.org/wiki/Common_Lisp#Implementations



Common Lisp开发工具

有了上面的commonlisp实现,也就是有了sdk,对于开发来说,必不可少的一个工具就是一个编辑器,好的编辑器可以让你的开发事半功倍。CommonLisp 最常用的编辑器就算emacs

另外使用emacs需要安装SLIME

SLIME The Superior Lisp Interaction Mode forEmacs从它的名字上你就能知道它是干什么的,简单来说,使用它我们可以非常轻松地体验CommonLisp编程的REPLRead-Eval-PrintLoop)旅程。

SLIME is a Emacs mode for Common Lisp development. Inspired byexisting systems such Emacs Lisp and ILISP,we are working to create an environment for hacking Common Lisp in.

SLIME works with GNU Emacs versions 21 and later, and with XEmacsversion 21 on Unix, , and .

The currently supported Common Lisp implementations are:

  • CMU Common Lisp (CMUCL)

  • Steel Bank Common Lisp (SBCL)

  • Clozure CL (a.k.a. OpenMCL)

  • LispWorks

  • Allegro CL

  • CLISP

  • Scieneer CL

  • ECL

  • Corman CL

  • ABCL



UbuntuCommon Lisp的安装


一篇好文:http://www.liyaos.com/blog/common-lisp-notes-0/

下文来自:http://blog.csdn.net/zheda3072211120/article/details/6953303


binghe学长的译作<<实用CommonLisp编程>>出版了..买了一本回来准备学习CL..


貌似在win下没有好的环境..所以只好在虚拟机下跑ubuntu来学习CL..


下面是我个人的安装过程..



1.安装emacs


sudo apt-get install emacs



目前最新的emacs貌似是23.多了..


说实话一直对emacs没爱..常年使用vim..但这次貌似只能学习下传说中的神器了..



2.安装lisp环境


同书上一样..选择了sbcl




sudo apt-get install sbcl clisp


sbcl的具体执行程序位置是/usr/bin/sbcl..这个后面配置emacs时会用



3.安装slime



sudo apt-get install slime


slime的位置在/usr/share/common-lisp/source/slime..这个后面也会用



4.配置emacs


~/.emacs中对emacs进行配置..我没什么经验..所以只好照抄网上的配置了..如下




(tool-bar-mode -1) ;这个关闭工具栏

(menu-bar-mode -1) ;这个关闭菜单栏

(setq inferior-lisp-program"/usr/bin/sbcl") ;sbcl的路径

(add-to-list 'load-path"/usr/share/common-lisp/source/slime") ;slime的路径

(require 'slime)

(slime-setup) ;slime安装


我已经习惯了vim那样啥也没有的纯键盘操作了..所以关掉了tool/menu..大家自己看着办



5.进入CL交互环境


启动emacs..并按Alt+x(术语貌似是M-x)..输入slime..然后就等待一会儿.出现CL-USER>..就表示OK..



好吧..接下来就是学习CL..


转载于:https://my.oschina.net/abcijkxyz/blog/720852

 类似资料: