在我的 linux 机器上安装 lisp
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6546834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install lisp on my linux machine
提问by Hieu Nguyen
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:
我使用 Vim 作为我的编辑器。“实用的通用 Lisp”建议安装 Lispbox,我不知道如何使用 emacs,不知道如何使用该 TT 运行 lisp 代码,之后我找到了 vim 的 lisp 插件,名为 lisp.vim,有很长的硬安装说明:((最后我安装了“Clisp”,我可以用一个简单的命令运行lisp代码:
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
但是如何编译呢?lisp 是编译语言吗?抱歉,我只是什么都不知道,我是 lisp 的新手
Can anybody tell me what exactly need to install lisp on my linux? What's SLIME, sbcl,.. etc.?
谁能告诉我在我的 linux 上安装 lisp 到底需要什么?什么是 SLIME、sbcl、.. 等?
采纳答案by whoplisp
Install and learn the following things:
安装和学习以下内容:
- SBCL the compiler
- SBCL 编译器
install a binary from http://www.sbcl.org/platform-table.htmlOnce 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.
从http://www.sbcl.org/platform-table.html安装二进制文件一旦你习惯了,从源代码编译并保留源代码。通过这种方式,您可以使用 M- 轻松跳转到 SBCL 的函数定义。在 Emacs 中。
- Emacs
- Emacs
watch this screencast to see someone implementing a raytracer Raytracer in Common Lisp
观看此截屏视频以了解有人在 Common Lisp 中实现了光线追踪器Raytracer
- quicklisp.lisp http://www.quicklisp.org/beta/
- 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)
这是新的包管理。当我开始时它不存在。现在我们有了它,你应该使用它。它使事情变得容易多了。运行 'sbcl --load quicklisp.lisp' 然后输入 (quicklisp-quickstart:install) 按回车然后运行 (ql:add-to-init-file)
SLIME runs within Emacs.
Try installing it with quicklisp. Read its manual and figure out what to write into your .emacs file so that it automatically starts when you open a lisp file. Optionally watch a screencast.
Paredit
SLIME 在 Emacs 中运行。
尝试使用 quicklisp 安装它。阅读它的手册并找出要写入 .emacs 文件的内容,以便在您打开 lisp 文件时它会自动启动。(可选)观看截屏视频。
帕雷特
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.
说真的,你必须学会这一点(即使光线追踪截屏中的那个人没有使用它)。您应该从 ( 开始,这将产生两个括号。使用 M-( 您可以包含现有的 s 表达式。Ck 会剪切光标后面的 s 表达式,而使用 Cy 您可以将其插入到任何位置。
- ASDF
- 自卫队
This is the make for lisp. You should learn how to define a system in an ASDF file.
这是 lisp 的制作。您应该学习如何在 ASDF 文件中定义系统。
- Reference
- 参考
I printed this booklet, Common Lisp Quick Reference. It's very concise.
我印刷了这本小册子,Common Lisp 快速参考。它非常简洁。
回答by Friedrich
Lisp can be compiled but that is not "necessarily" so. Clispis just one Lisp running on Linux. SBCLis another one. And SLIMEis the interface from Emacs to one can say all Lisps on Linux.
Lisp 可以编译,但这不是“必然”的。Clisp只是一个运行在 Linux 上的 Lisp。SBCL是另一个。而SLIME是从 Emacs 到 Linux 上所有 Lisps 的接口。
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.
您可以将 Slime 与 SBCL、CLisp、Lispworks 和 Franz Common Lisp 一起使用。你甚至可以通过使用 Emacs 来学习 Lisp 的大部分内容。它有自己的 Lisp 方言 Elisp,但您也可以使用 Common Lisp 兼容库。
Emacs probably is a preferred IDE for Common Lisp because of it's use of an internal Lisp.
Emacs 可能是 Common Lisp 的首选 IDE,因为它使用了内部 Lisp。
If you want one software to install you should check LispWorksor Allegro Common Lisp(formerly FranzCommon Lisp).
如果你想安装一个软件,你应该检查LispWorks或Allegro Common Lisp(以前的FranzCommon Lisp)。
回答by John McAleely
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.
您可以使用您在其他语言(编辑、编译、运行)中习惯的习语来学习 lisp。从长远来看,lisp 提供了您可能会喜欢的其他选择。
So long as Vim will balance ()'s as you type, it has the only feature you really need in your editor.
只要 Vim 在您键入时平衡 (),它就有您在编辑器中真正需要的唯一功能。
Eventually, you might well choose to look into SLIME (which needs emacs), but it's certainly not necessary to get started.
最终,您可能会选择研究 SLIME(需要 emacs),但肯定没有必要开始。
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).
您可以选择任何“Common Lisp”实现(其中 clisp 似乎是您已经拥有的)。有些会编译成一个独立的二进制文件(就像你可能习惯从 C 一样使用工具链),但大多数将取决于 lisp 附带的运行时,即使 .lisp 文件被编译(类似于 Java、Python 等)。
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.
您可以在 lisp 的文档中查找“ compile-file”以了解如何编译 .lisp 文件。Common Lisp 在语言运行时中包含编译器。
回答by hexicle
Can anybody tell me what exactly need to install lisp on my linux?
谁能告诉我在我的 linux 上安装 lisp 到底需要什么?
The other answers have described what SLIME, sbcl etc. are. But I wanted to give a concise answer.
其他答案描述了 SLIME、sbcl 等是什么。但我想给出一个简洁的答案。
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.
要在 Ubuntu 上安装 clisp,只需运行sudo apt-get install clisp
. 运行 Lisp 不需要其他任何东西。对于其他发行版,请在其相关的包管理器上找到 clisp。然而,在某些发行版上没有找到 clisp 并不奇怪,例如 Amazon Linux AMI 似乎没有 clisp。clisp ~/test.lisp
这就是运行 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.
现在更流行使用 SLIME 和 ASDF。作为初学者,您还不需要使用它们。SLIME 是 Lisp 的精美编辑器,ASDF 是包管理器。设置Clisp 简单得多,因为它实际上只需要一行安装和一行运行。SLIME 和 ASDF 涉及更多,需要更多时间来学习和设置。我个人建议从使用 Clisp 开始,然后再使用 SLIME 和 ASDF,以便您更好地了解 Lisp,这将使使用 SLIME 和 ASDF 变得更加容易。准备好后,我建议您阅读 SLIME 和 ASDF 的文档。