OSX如何搭建Common Lisp开发环境? (编程新手)

How to set up a Common Lisp development environment for OSX? (Programming Newbie)

所以,我对编程很陌生。 我想学习 Common Lisp。 几年前,我用IDLE编写和运行 Python代码。在我准备好学习一些软件之前,它所涉及的只是下载和安装一个软件 Python.

使用 Common Lisp,事情似乎要复杂得多。我需要安装:

有人可以简化这个过程让我遵循吗?

我在 Homebrew 的帮助下安装了 SBCL 和 emacs。现在我只是想让 SLIME 与所有东西一起工作。

按照本网站的说明进行操作 https://gist.github.com/CodeOmar/9477900#install-slime,我尝试安装 quicklisp。 但是我无法激活 SLIME。当我启动 emacs 时,[M-x package-install RET slime RET],它说 'no match'.

请像我是 8 岁的孩子一样回答这个问题。 如果有更简单的方法来设置工作的 Common Lisp 环境,我将很高兴听到。

在我看来,在 Mac OS X 环境中使用 Common Lisp 的最简单方法是从 Apple Store 安装 Clozure CL implementation。它是标准 ANSI Common Lisp 的完整实现,非常简单,Mac-友好 IDE。当你掌握了这门语言后,你可以安装带有 Slime 的 Emacs,并选择继续使用 Clozure CL 或转到 SBCL(或使用其他实现)。

已编辑

另一种可能性是使用由 Franz (Allegro CL, Free Express Edition), or from LispWorks (LispWorks personal edition) 提供的商业实现的免费版本提供的集成环境。但是,它们有局限性,并且 Allegro CL 需要非立即安装。此外,它们最好与 Common Lisp 的一些高级知识一起使用。

曾经有一个 "batteries included" 发行版伴随着 Practical Common Lisp。我不认为它是特别最新的,但我可能是错的。

以下是我设置 lemon 或 Emacs 环境的方法;我对 VIM 和 SLIMV 进行了类似的安装。 警告:我在非标准位置安装了多个 CL 实现。

(a) 使用 git 克隆当前的史莱姆(我的恰好在 ~/elisp/slime,添加你自己的调味料以适应你的口味):

$ mkdir ~/elisp
$ cd ~/elisp
$ git clone https://github.com/slime/slime.git

(b) 将以下代码片段添加到您的 .emacs:

;; Setup SLIME
;; Use the copy in my home directory.
(let ((my-slime-directory (expand-file-name "~/elisp/slime")))
(add-to-list 'load-path my-slime-directory)
(setq slime-backend (expand-file-name "swank-loader.lisp" my-slime-directory)))

;; If you installed your CL in a "standard place", such as /opt/local/bin,
;; you can delete the following form/6 lines. If you have multiple CLs installed,
;; this is an example of how you enumerate them; C-u M-x slime then lets
;; select one by name. Default is the first CL implementation in the list.
(setf slime-lisp-implementations
   `((ccl64 (,(expand-file-name "~/.local/bin/ccl64"))
             :env (,(concat "CCL_DEFAULT_DIRECTORY=" (expand-file-name "~/ccl"))))
     (clisp ("clisp"))
     (ecl (,(expand-file-name "~/ecl-experimental/bin/ecl")))
     (sbcl (,(expand-file-name "~/.local/bin/sbcl")))))

;; Mac OSX owns C-up and C-down, so arrange for history
;; navigation to do something useful via C-c p and C-c n.
(eval-after-load 'slime
  `(progn
     (define-key slime-prefix-map "p" 'slime-repl-backward-input)
     (define-key slime-prefix-map "n" 'slime-reply-forward-input)))

;; Useful slime custribs
(require 'slime-autoloads)
(add-to-list 'slime-contribs 'slime-repl)
(add-to-list 'slime-contribs 'slime-autodoc)
(add-to-list 'slime-contribs 'slime-fancy)

(c) 如果您需要或想要 MELPA,这就是您 .emacs:

中应该包含的内容
;; Package and MELPA package archive setup:
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)

(d) 启动 Emacs 和 M-x slime.

HTH。 :-)