首页 > 代码库 > Get start with "Lisp"

Get start with "Lisp"

Get start with "Lisp"



          在《黑客与漫画》中,Paul graham提到什么才是最好的编程语言,Lisp和C被明显的提及,对可谓是Lisp是推崇备至。最近准备看SICP,于是学一下极具逼格的Lisp。




The basic, if primitive, way to get Lisp running is to install a command-line Lisp system. This works especially well if you have a UNIX system (OS X or Linux). Command-line Lisps include:

  • SBCL is a recent revision of CMUCL with new modifications and additions.I recommend SBCL as the best command-line Lisp. However, SBCL is very verbose and warning-filled though, which can get quite annoying. On the Mac, if you prefer a quieter, more forgiving, and decently fast Lisp, try CCL or MCL.

  • CLISP is a good Common Lisp, and is highly portable to nearly every environment out there. However, the reason it is portable is that it compiles to a bytecode interpreter rather than to machine code, and so it‘s pretty slow.

  • MCL is a freeware command-line-only version of Macintosh Common Lisp, which runs under MacOS X nicely. It is much faster than CLISP on the Mac, but its debugging facilities are primitive.

  • CCL, or Clozure CL, was a fork of MCL way back when but now is a high-performance Lisp implementation in its own right, and runs on a lot of different platforms. If you‘re getting annoyed at SBCL‘s verbosity, try CCL.

  • CMUCL is a first-rate Common Lisp, but it is not available on all platforms. CMUCL is the system from which SBCL sprang.

  • If you‘re interested in playing around with it, ABCL is a Common Lisp implementation which runs on the Java VM. Note that it‘s not particularly fast (yet).



这里推荐使用SBCL。其它的嘛,自己看吧。。。我下了两个,一个SBCL,一个CLISP。


linux下面,检测好自己预先装了SBCL,

ubuntu@ubuntu:~$ which sbcl
/usr/bin/sbcl

如果没有装

sudo apt-get install sbcl


第一个Lisp程序,你一定猜得到

在当前文件夹下编辑

vim ./hello.lisp

(princ "hello world!")

然后进入sbcl

ubuntu@ubuntu:~$ vim ./hello.lisp
ubuntu@ubuntu:~$ sbcl
This is SBCL 1.1.1.0.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (load "hello.lisp")
hello world!
T



一切从这里开始,hello world。


一切在这里结束,EOF