Reputation: 63
So, I am very new to programming. I would like to learn Common Lisp. A few years ago, I used IDLE to write and run Python code. All it involved was downloading and installing one piece of software before I was ready to learn some Python.
With Common Lisp, things seem to be a lot more complex. I need to install:
Could somebody make this a simpler process for me to follow?
I installed SBCL and emacs both with the help of Homebrew. Now I'm just trying to get SLIME to work with everything.
Following the instructions from this site https://gist.github.com/CodeOmar/9477900#install-slime, I attempted to install quicklisp. But I can't activate SLIME. When I launch emacs, [M-x package-install RET slime RET], it says 'no match'.
Answer this question like I'm an 8 year old, please. If there is an easier way to set up a working Common Lisp environment, I would be glad to hear it.
Upvotes: 6
Views: 3638
Reputation: 1063
There used to be a "batteries included" distribution that accompanied Practical Common Lisp. I don't think it's particularly current, but I could be wrong.
Here's how I set up my lemon oder Emacs environment; I have a similar installation for VIM and SLIMV. Caveat: I have several CL implementations installed in nonstandard places.
(a) Use git to clone the current SLIME (mine happens to be in ~/elisp/slime
, add your own seasoning to suite your tastes):
$ mkdir ~/elisp
$ cd ~/elisp
$ git clone https://github.com/slime/slime.git
(b) Add the following snippet to your .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) If you need or want MELPA, this is what you should have in your .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) Fire up Emacs and M-x slime
.
HTH. :-)
Upvotes: 2
Reputation: 27424
The simplest way, in my opinion, to approach Common Lisp in the Mac OS X environment, is to install from the Apple Store the fine Clozure CL implementation. It is a full implementation of standard ANSI Common Lisp with a very simple, Mac-friendly IDE. When you have mastered the language, you can install Emacs with Slime, and choose to stay with Clozure CL or pass to SBCL (or use some other implementation).
Edited
Another possibility is to go with the integrated environment provided by the free versions of the commercial implementations, either from Franz (Allegro CL, Free Express Edition), or from LispWorks (LispWorks personal edition). They have limitations, however, and Allegro CL requires a non immediate installation. Moreover, they are best used with some advanced knowledge of Common Lisp.
Upvotes: 4