@@ -6,23 +6,35 @@ Now that you've gotten yourself a feel for Common Lisp, you'll want to spend a l
...
@@ -6,23 +6,35 @@ Now that you've gotten yourself a feel for Common Lisp, you'll want to spend a l
### Installing SBCL
### Installing SBCL
Steel Bank Common Lisp is one of the easiest Lisp implementations to get up and running—it has out of the box support for a wide selection of platforms, and is considered to be the most robust implementation available. Since it automatically compiles everything you enter at the REPL, your running Lisp processes also benefit from a major speed-boost over other Lisps.
Steel Bank Common Lisp, or SBCL for short, is one of the easiest Lisp implementations to get up and running—it's free and open-source, actively developed, is supported for a wide selection of platforms, and is considered to be the most robust open-source implementation available. Since it automatically compiles everything you enter at the REPL, your running Lisp processes also benefit from a major speed-boost over other Lisps.
{% hint style='info' %}
{% hint style='info' %}
The SBCL REPL is minimal by design, since it is primarily used from within Emacs+SLIME which provides its own custom prompt, history, completion, multi-line editing capabilities, and more. In order to use it effectively straight from the command-line, you will need to install a separate tool on OS X and Linux called `rlwrap`, a readline wrapper. It provides evaluation history, multi-line editing, and can be configured for completions and filters. You can read more about `rlwrap` here: https://github.com/hanslub42/rlwrap
The SBCL REPL is minimal by design, since it is primarily used from within Emacs+SLIME which provides its own custom prompt, history, completion, multi-line editing capabilities, and more. In order to use it effectively straight from the command-line, you will need to install a separate tool on macOS and Linux called `rlwrap`, a readline wrapper. It provides evaluation history, multi-line editing, and can be configured for completions and filters. You can read more about `rlwrap` here: https://github.com/hanslub42/rlwrap
{% endhint %}
{% endhint %}
You can learn more about SBCL at the official website: https://sbcl.org/
#### Windows
#### Windows
The latest SBCL installer packages for Windows, in separate versions for 32 and 64-bit systems, are available on the official downloads page.
The latest SBCL installer packages for Windows, in separate versions for 32 and 64-bit systems, are available on the official downloads page.
Once installed, you can run SBCL from the Start menu, or call it from a command-line window. If you have PowerShell installed, it offers better features than the default command line.
Once installed, you can run SBCL from the Start menu, or call it from a command-line window. If you have PowerShell installed, it offers better features than the default command line.
#### OS X
#### macOS
On macOS, the most recent version of SBCL is available through the Homebrew package manager:
```sh
$ brew install sbcl
```
You will also want to install the `rlwrap` package:
On Mac OS X, you will want to install SBCL through the Homebrew package manager.
```sh
$ brew install rlwrap
```
You will also want to install the `rlwrap` package, and run SBCL from the terminal as follows:
Then you can run SBCL from the terminal as follows:
```sh
```sh
$ rlwrap sbcl
$ rlwrap sbcl
...
@@ -30,7 +42,7 @@ $ rlwrap sbcl
...
@@ -30,7 +42,7 @@ $ rlwrap sbcl
#### Linux
#### Linux
Most Linux distros have the latest, or a very recent, version of SBCL in their official repositories. You can simply install it from there.
Most Linux distros have the latest, or a very recent, version of SBCL in their official package repositories. You can install it with the package manager for your Linux distro as you would any other software.
You will also want to install the `rlwrap` package, and run SBCL from the shell as follows:
You will also want to install the `rlwrap` package, and run SBCL from the shell as follows:
...
@@ -50,10 +62,23 @@ Using the old version of SBCL, you may now compile the latest version of SBCL fr
...
@@ -50,10 +62,23 @@ Using the old version of SBCL, you may now compile the latest version of SBCL fr
Once you have SBCL up and running, the first thing you should do is install Quicklisp. It's a package manager for Lisp, and will allow you to dynamically load community-supported libraries (which typically include ASDF systems and their associated Lisp packages) into your running Lisp image. It also automatically resolves dependencies for your own Lisp projects.
Once you have SBCL up and running, the first thing you should do is install Quicklisp. It's a package manager for Lisp, and will allow you to dynamically load community-supported libraries (which typically include ASDF systems and their associated Lisp packages) into your running Lisp image. It also automatically resolves dependencies for your own Lisp projects.
From the command-line:
From the command-line, download the Quicklisp installation script and release signing key:
@@ -85,16 +110,15 @@ You can put your Lisp projects under `~/quicklisp/local-projects/` so that Quick
...
@@ -85,16 +110,15 @@ You can put your Lisp projects under `~/quicklisp/local-projects/` so that Quick
### Choosing a Text Editor
### Choosing a Text Editor
If you ask any Lisp developer what editor you should be using, or what IDE is available for Common Lisp, the first thing they'll tell you is, Emacs. Emacs and SLIME (the Superior Lisp Interaction Mode for Emacs), makes a powerful combination. You can control the entire environment with your keyboard, never having to waste time reaching for the mouse; run, test, and debug code in the REPL as you write it in another buffer; experiment and explore alternate approaches to solving the same problem, profiling your code to get the best performance; and have the full Common Lisp HyperSpec at your fingertips. The only problem is, some users really dislike Emacs, or simply don't know it. The steep learning curve can be a real damper to your progress when coming to both Lisp and Emacs as a newbie; so the policy of this book is, use what you know, and make it work until you know Lisp well enough to get comfortable learning Emacs. If you wait until the right time, learning Emacs will be a boost to your productivity, not a hindrance.
All you need to get started with Lisp is a simple, no-frills text editor with syntax highlighting, so that you can focus on learning Lisp itself and not get distracted by fiddling with an unfamiliar environment. A few worth checking out are:
If you know Emacs and have a great disdain for it, far preferring Vim, you can take advantage of most of the features of SLIME through the Vim package, Slimv.
For users who have no experience with Emacs or Vim, all you really need at the moment is a simple text editor. Anything more will probably just confuse you, and keep you from focusing on Lisp itself. A few worth checking out are:
* Sublime Text: very well supported, extensible, and actively maintained; syntax highlighting for Lisp is built-in; a REPL plugin is available so you can get a similar experience to Emacs without as steep a learning curve. Free to try, but requires a paid license for continued use. It is available to download for Windows, OS X, and Linux.
* For Windows, macOS, and Linux:
* Atom: currently in beta, built entirely on Web technologies, GitHub's Atom Editor is like a stripped-down Sublime Text with a few unique features. A plugin for Lisp syntax highlighting is available for download within the editor settings. Binaries are available to download for OS X and Windows 7 and 8; the source code is available to compile for other systems, although in Linux it may be available in your package manager.
* VSCode
* Cloud9: the Cloud9 service is like Sublime Text or Atom in the browser. You can access your code from anywhere, sync it up with your repo, collaborate on code, and more. Syntax highlighting for Lisp is built-in. Cloud9 has both free and premium plans. Best viewed in Chrome, Safari, and Firefox.
* Sublime Text
* Notepad++: A clean and simple text editor with syntax highlighting for Lisp. Available for Windows.
* Atom
* UltraEdit
* Windows only
* Notepad++
Other popular text and code editors, such as BBedit, TextWrangler, and Gedit, do not have syntax highlighting for Lisp.
Other popular text and code editors, such as BBedit, TextWrangler, and Gedit, do not have syntax highlighting for Lisp.