This is how you start programming in Lisp.

A series of kind suggestions from the helpers of #lisp

This page is my personal suggestion for how a new user should go about setting up their environment to learn Common Lisp, what tutorials to investigate, and where they should seek help and guidance. It's also a tutorial on how to pick a configuration that other people are going to be able to help you with. What this boils down to is whether you care if you get laughed at instead of helped. If you do care, follow this guide.

If you do not follow these instructions, you will receive much less helpful advice from the regulars of #lisp. If you deviate too much, you will likely be ignored. Therefore, if you actually want help, follow these directions.

Picking a Lisp implementation

Note for Windows users: If you're running Windows and don't have the option of using some kind of UNIX-like, the best resource for Common Lisp will be Bill Clementson's Blog. In particular this entry is a good guide to setting up with various CL implementations on Win32. My advice is to try CLISP and not the others unless you know you are interested in a commercial product. Of course, if you're not running Windows, there are higher quality implementations available, which I'll focus on here.

There is a lot of variety in Common Lisp implementations. If you are just starting with Common Lisp, it can be confusing to pick one. Many times people pick the wrong ones to start with because they go searching for a GNU lisp. These are the lisp implementations you should choose.

N.B. Only free-as-in-libre lisps are considered here, as few of the active #lisp helpers use a commercial lisp, while many help develop free ones. If you want a commercial implementation, there are many available, and they all have support resources for new users that you should consult in event of trouble.

There are other Common Lisp implementations out there. Using a free implementation other than SBCL, CMUCL, or OpenMCL to get started will likely leave you with a bad impression of Common Lisp. Don't Do It. Learning Scheme and thinking that it's the same as Common Lisp is also a big mistake. Don't Do That Either.

Bottom line: you want SBCL, CMUCL, or OpenMCL.

Getting a development environment

There is only one development environment that is recommended for free Common Lisps. It is called SLIME, and it is implemented as a mode for Emacs. Many people say "I don't use Emacs; can't I use vi / eclipse / whatever wonky editor?". The answer is "no". You can't easily write Lisp in any editor but an Emacs-like one, and the best option for an Emacs-like editor is Emacs or XEmacs. Using a plain text editor without any runtime connection to your Lisp implementation just because you think you prefer its keybindings is stupid and self-defeating.

"I'd like to learn Russian but I have no time to memorize this funny alphabet." - cliini

To install SLIME, follow the directions to obtain the latest version, and then add these lines to a file called .emacs in your home directory:

(add-to-list 'load-path "/where/you/put/slime")
(require 'slime)
(setq inferior-lisp-program "yourlisp")
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)
			    (local-set-key "\r" 'newline-and-indent)
			    (setq lisp-indent-function 'common-lisp-indent-function)
			    (setq indent-tabs-mode nil)))

Replace "/where/you/put/slime" with the path where you put the slime directory, and "yourlisp" with one of:

When you want to start SLIME, hold down the Alt key (either Option or Meta on a Mac, depending on your emacs configuration) and hit the x key. Your cursor should be on the last line of the screen. Type slime and press enter. SLIME should start in a few minutes (possibly after some compiler messages flash by) and present you with an interactive REPL. From there you're ready to start using Lisp.

Bottom line: SLIME is the only free development environment for Common Lisp, and it only runs under Emacs. Learn to use it.

Getting a tutorial

If you picked SBCL (a good choice to start with), there is a short tutorial which will help you set it up as your development environment. Even if you didn't, reading it anyway might be useful. There are several well written books out there on Common Lisp. If you are just getting started with Lisp, the best text to use would be Practical Common Lisp: Some other texts that are often recommended are: There are many other texts out there, but many apply to pre-ANSI Common Lisp. Chances are you will be happiest with these texts, even if you must pay to purchase a copy (gasp!).

Bottom Line: pick a good book and read it, cover to cover.

Other Things to Remember

If you're coming from a C-like language, you will be tempted to put individual closing parentheses on their own lines. Don't. Put them all together on the same line, and use the Emacs S-Expression editing commands to work with your code.

Let Emacs indent your source code. It will intelligently line up S-Expressions into a format which is readable and which most other people are accustomed to. Emacs can do this automatically for you when you hit the Tab key on a line.

Other Resources

Lisp is a language with a fifty-year history. Because of that, there's a lot of old crap out there on the Internet for Google to find. If you want sensible resources on CL, I'd recommend starting from the following pages:

Final Thought

Follow these directions or risk our wrath, or at least unsympathetic attitudes!
An officially sanctioned product of the #lisp Yabos.