Getting Started with Common Lisp
Here you can find short notes about setting up a fresh Common Lisp environment and how to create your first project.
Environment Setup
Start by installing these applications (or some equivalent):
-
SBCL: one of the most popular CL compilers. It can be installed by the package manager (like
apt-get install sbcl
). - Emacs/Spacemacs: a decent editor. For Vim users like
me, I suggest Spacemacs (check
my configuration).
- Slimv is also a very good alternative for Vim users.
- Quicklisp: the most popular library manager.
- ASDF: “a system definition facility for Common Lisp programs and libraries”. This will be installed automatically by Quicklisp just by following the other steps in the next sections. However, we need to set it up.
New Project
Taken from Baggers:
- In a terminal, call sbcl inside the parent directory of your new project
- Load quickproject:
(ql:quickload :quickproject)
- Create the project structure:
(quickproject:make-project "some-project-name")
- Check the new directory some-project-name
The project structure (or the “system”) is defined in the file some-project-name.asd. Follow this reference to understand better the file.
Cloning a project template is another quick approach.
Version Management
As far as I know, Quicklisp doesn’t understand the dependencies’ versions defined in the asd file. However, I like to put their versions down anyway, like this:
Conclusion
After some years coding in Clojure, I got really used to the facilities provided by Leiningen and Maven; for CL, I was surprised that I couldn’t easily find a way to start some serious, well organized project. In this post I try to summarize all the information I gathered from many different sources just to start a new simple project.
If you have some better suggestion, please send it to me by email. I would be really happy to learn something more.