简体   繁体   English

在我的 linux 机器上安装 lisp

[英]Install lisp on my linux machine

I use Vim as my editor.我使用 Vim 作为我的编辑器。 "Practical common Lisp" suggest installing Lispbox, I don't know how to use emacs, don't know how to run lisp code with that TT 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: "Practical common Lisp" suggest installing Lispbox, I don't know how to use emacs, don't know how to run lisp code with that TT after that i find lisp plugin for vim called limp.vim with a long and hard install instruction :(( 最后我安装了“Clisp”,我可以用一个简单的命令运行 lisp 代码:

clisp ~/test.lisp

But how to compile it?但是如何编译呢? Is lisp a compiled language? lisp 是编译语言吗? sorry, i just don't know anything, i'm newbie in lisp对不起,我什么都不知道,我是 lisp 的新手

Can anybody tell me what exactly need to install lisp on my linux?谁能告诉我在我的 linux 上安装 lisp 到底需要什么? What's SLIME, sbcl,.. etc.?什么是 SLIME、sbcl、.. 等?

Lisp can be compiled but that is not "necessarily" so. Lisp 可以编译,但这不是“必要”的。 Clisp is just one Lisp running on Linux. Clisp只是一个在 Linux 上运行的 Lisp。 SBCL is another one. SBCL是另一个。 And SLIME is the interface from Emacs to one can say all Lisps on Linux.SLIME是从 Emacs 到可以说 Linux 上的所有 Lisp 的接口。

You can use Slime with SBCL, CLisp, Lispworks and Franz Common Lisp.您可以将 Slime 与 SBCL、CLisp、Lispworks 和 Franz Common Lisp 一起使用。 You can even learn much of Lisp just by using Emacs.你甚至可以通过使用 Emacs 来学习很多 Lisp。 It has it's own Lisp-dialect Elisp, but you can use Common Lisp compatibility libraries also.它有自己的 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 LispWorks or Allegro Common Lisp (formerly Franz Common Lisp).如果您想安装一个软件,您应该检查LispWorksAllegro Common Lisp (以前称为Franz Common Lisp)。

Install and learn the following things:安装并学习以下内容:

  • SBCL the compiler SBCL 编译器

install a binary from http://www.sbcl.org/platform-table.html Once your used to it, compile from source and keep the source around.http://www.sbcl.org/platform-table.html安装一个二进制文件一旦你习惯了它,从源代码编译并保留源代码。 This way you can easily jump to the definitions of functions of SBCL with M-.这样,您可以轻松地使用 M- 跳转到 SBCL 的函数定义。 in Emacs.在 Emacs 中。

  • Emacs Emacs

watch this screencast to see someone implementing a raytracer Raytracer in Common Lisp观看此截屏视频,了解有人在 Common Lisp 中实现光线追踪器 Raytracer

This is the new package management.这是新的 package 管理。 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. SLIME 在 Emacs 内运行。

    Try installing it with quicklisp.尝试使用 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.阅读它的手册并找出在您的.emacs 文件中写入的内容,以便在您打开 lisp 文件时自动启动。 Optionally watch a screencast.可选择观看截屏视频。

  • Paredit编辑

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. Ck cuts the s-expression behind the cursor and with Cy you can insert it anywhere.您应该以 ( 开头,这将产生两个括号。使用 M-( 您可以将现有的 s 表达式括起来。Ck 将 s 表达式剪切到 cursor 后面,使用 Cy 您可以将其插入到任何地方。

  • ASDF自卫队

This is the make for lisp.这是 lisp 的组成部分。 You should learn how to define a system in an ASDF file.您应该学习如何在 ASDF 文件中定义系统。

  • Reference参考

I printed this booklet, Common Lisp Quick Reference .我打印了这本小册子Common Lisp Quick Reference It's very concise.它非常简洁。

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.其他答案描述了 SLIME、sbcl 等是什么。 But I wanted to give a concise answer.但我想给出一个简洁的答案。

To install clisp on Ubuntu, just run sudo apt-get install clisp .要在 Ubuntu 上安装 clisp,只需运行sudo apt-get install clisp Nothing else is necessary to run Lisp.运行 Lisp 不需要其他任何东西。 For other distros find clisp on their relevant package managers.对于其他发行版,请在其相关的 package 管理器上找到 clisp。 However do not be surprised not to find clisp on some distros, for example the Amazon Linux AMI appears not to have clisp.但是,在某些发行版上没有找到 clisp 并不奇怪,例如 Amazon Linux AMI 似乎没有 clisp。 clisp ~/test.lisp is all you need to run Lisp. clisp ~/test.lisp是运行 Lisp 所需要的一切。

Nowadays it is more popular to use SLIME and ASDF.现在更流行的是使用 SLIME 和 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. SLIME 是 Lisp 的精美编辑器,ASDF 是 package 管理器。 It is much easier to setup Clisp given that it literally takes just one line to install and one line to run.设置 Clisp 要容易得多,因为它实际上只需要安装一条线并运行一条线。 SLIME and ASDF are more involved and take more time to learn and setup. SLIME 和 ASDF 参与度更高,需要更多时间来学习和设置。 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.我个人建议从使用 Clisp 开始,然后再使用 SLIME 和 ASDF,以便您更好地了解 Lisp,这将使使用 SLIME 和 ASDF 变得更加容易。 When you are ready, then I recommend reading the documentation of SLIME and ASDF.当你准备好后,我推荐阅读 SLIME 和 ASDF 的文档。

You can learn lisp using the idioms you're used to from other languages (editing, compiling, running).您可以使用其他语言(编辑、编译、运行)习惯的习语来学习 lisp。 In the long run, lisp offers other choices, which you may come to prefer.从长远来看,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).您可以选择任何“Common Lisp”实现(其中 clisp 似乎是您已经拥有的)。 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). 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.您可以在 lisp 的文档中查找“ compile-file ”以了解如何编译 .lisp 文件。 Common Lisp's include the compiler in the language runtime. Common Lisp 将编译器包含在语言运行时中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM