在 mac 上怎样搭建 Lisp 开发环境?

在Mac下搭建Common Lisp开发环境(Emacs)Lisp编译器(解释器)
首先需要一个Lisp的编译器,SBCL是一个开源的实现,支持所有POSIX平台。你可以选择从源码编译,也可以下载二进制包。而由于使用mac,可以用强大的homebrew来安装:
$ brew install sbcl1 $ brew install sbcl简单使用
使用sbcl启动交互环境,如果用lisp的术语来说,这是一个REPL(read–eval–print loop )。这个环境中就可以尝试Common Lisp编程了。
$ sbclThis is SBCL 1.1.7.0-aeb9307, an implementation of ANSI Common Lisp.More information about SBCL is available at \u0026lt;http://www.sbcl.org/\u0026gt;.SBCL is free software, provided as is, with absolutely no warranty.It is mostly in the public domain; some portions are provided underBSD-style licenses. See the CREDITS and COPYING files in thedistribution for more information.* (+ 1 2 3 4 5 6)**21*** (quit)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 $ sbcl This is SBCL 1.1.7.0-aeb9307, an implementation of ANSI Common Lisp. More information about SBCL is available at \u0026lt;http://www.sbcl.org/\u0026gt;. 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. * (+ 1 2 3 4 5 6) **21** * (quit) $但是这个环境对开发者不是非常友好,比如不支持上下键导航,不支持左右键,非常原始,可以使用Emacs来作为开发环境,当然如果你更喜欢vim(像我一样),也没有任何问题。不过这是一个很好的学习Emacs编辑环境的机会,可以尝试一下。
Emacs + Slime
Slime是一个Emacs下开发Common Lisp程序的一个插件,它本身就是由lisp写成的,下载之后是一个压缩包,将其解压缩到~/.eamcs.d/目录中即可。 然后在~/.emacs文件中添加下面的配置:
; slime setup(setq inferior-lisp-program "/usr/local/bin/sbcl")(add-to-list \u0026#39;load-path "~/.emacs.d/slime/")(require \u0026#39;slime)(slime-setup1 2 3 4 5 ; slime setup (setq inferior-lisp-program "/usr/local/bin/sbcl") (add-to-list \u0026#39;load-path "~/.emacs.d/slime/") (require \u0026#39;slime) (slime-setup)Emacs的“开发者”配置
默认的eamcs界面比较简陋,我的vim使用的solarized主题,觉得配色非常合理,结果在github上发现了其对应的emacs主题。现在之后,同样解压在~/.emacs.d/目录中,然后在~/.emacs加上一下配置即可。
; color theme setup (add-to-list \u0026#39;custom-theme-load-path "~/.emacs.d/emacs-color-theme-solarized/")(load-theme \u0026#39;solarized-dark t); hide the tool bar(tool-bar-mode -1); set the font(set-face-attribute \u0026#39;default nil :font "Monaco")(set-face-attribute \u0026#39;default nil :height 170)1 2 3 4 5 6 7 8 9 10 ; color theme setup (add-to-list \u0026#39;custom-theme-load-path "~/.emacs.d/emacs-color-theme-solarized/") (load-theme \u0026#39;solarized-dark t) ; hide the tool bar (tool-bar-mode -1) ; set the font (set-face-attribute \u0026#39;default nil :font "Monaco") (set-face-attribute \u0026#39;default nil :height 170)
■网友
选个实现,装解释器。然后emacs,scheme用geyser,common lisp用slime


推荐阅读