可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I use Vim as my editor. "Practical common Lisp" suggest installing Lispbox, I don't know how to use emacs, don't know how to run lisp code with that T.T after that i find lisp plugin for vim called limp.vim with a long and hard install instruction :((
Finally i installed "Clisp" and i can run lisp code with a simple command:
clisp ~/test.lisp
But how to compile it? Is lisp a compiled language? sorry, i just don't know anything, i'm newbie in lisp
Can anybody tell me what exactly need to install lisp on my linux? What's SLIME, sbcl,.. etc.?
回答1:
Install and learn the following things:
install a binary from http://www.sbcl.org/platform-table.html Once your used to it, compile from source and keep the source around. This way you can easily jump to the definitions of functions of SBCL with M-. in Emacs.
watch this screencast to see someone implementing a raytracer Raytracer in Common Lisp
- quicklisp.lisp http://www.quicklisp.org/beta/
This is the new package management. When I started it wasn't there. Now we have it and you should use it. It makes things a lot easier.
Run 'sbcl --load quicklisp.lisp' and then enter (quicklisp-quickstart:install) press enter
and then run (ql:add-to-init-file)
Seriously, you have to learn that (even if the guy in the raytracing screencast didn't use it). You should start with ( , this will make two parenthesis. With M-( you can enclose an existing s-expression. C-k cuts the s-expression behind the cursor and with C-y you can insert it anywhere.
This is the make for lisp. You should learn how to define a system in an ASDF file.
I printed this booklet, Common Lisp Quick Reference. It's very concise.
回答2:
Lisp can be compiled but that is not "necessarily" so. Clisp is just one Lisp running on Linux. SBCL is another one. And SLIME is the interface from Emacs to one can say all Lisps on Linux.
You can use Slime with SBCL, CLisp, Lispworks and Franz Common Lisp.
You can even learn much of Lisp just by using Emacs. It has it's own Lisp-dialect Elisp, but you can use Common Lisp compatibility libraries also.
Emacs probably is a preferred IDE for Common Lisp because of it's use of an internal Lisp.
If you want one software to install you should check LispWorks or Allegro Common Lisp (formerly Franz Common Lisp).
回答3:
Can anybody tell me what exactly need to install lisp on my linux?
The other answers have described what SLIME, sbcl etc. are. But I wanted to give a concise answer.
To install clisp on Ubuntu, just run sudo apt-get install clisp
. Nothing else is necessary to run Lisp. For other distros find clisp on their relevant package managers. However do not be surprised not to find clisp on some distros, for example the Amazon Linux AMI appears not to have clisp. clisp ~/test.lisp
is all you need to run Lisp.
Nowadays it is more popular to use SLIME and ASDF. As a beginner you will not need to use them yet. SLIME is a fancy editor for Lisp, and ASDF is a package manager. It is much easier to setup Clisp given that it literally takes just one line to install and one line to run. SLIME and ASDF are more involved and take more time to learn and setup. I personally would recommend starting off with using Clisp and only later on using SLIME and ASDF so that you will gain a better understanding of Lisp which will make using SLIME and ASDF much easier. When you are ready, then I recommend reading the documentation of SLIME and ASDF.
回答4:
You can learn lisp using the idioms you're used to from other languages (editing, compiling, running). In the long run, lisp offers other choices, which you may come to prefer.
So long as Vim will balance ()'s as you type, it has the only feature you really need in your editor.
Eventually, you might well choose to look into SLIME (which needs emacs), but it's certainly not necessary to get started.
You can choose any 'Common Lisp' implementation (of which clisp appears to be one you already have). Some will compile to a standalone binary (as you may be used to from C like toolchains), but most will depend on the runtime the lisp comes with, even when the .lisp file is compiled (similar to Java, Python, etc).
You can lookup 'compile-file' in your lisp's documentation to see how to compile .lisp files. Common Lisp's include the compiler in the language runtime.