Source repository

Common Lisp REPL Exploration Guide

Emacs/Slime edition

Glossary

symbol

A name. Like a variable, but can be used without an attached value.

system

A library

package

A module, more fine-grained than a system. Systems often contain multiple packages.

(at) point

Emacs will often apply commands to the item under the cursor. This item is said to be at point.

M-

A reference to the meta modifier key. This is usually the Alt key on PCs and the command key on Macs.

repl

The interactive prompt of a live lisp session.

quicklisp, alias ql

Common Lisp's de facto package manager.

Starting and Stopping Lisp

Start lisp from within emacs

M-x slime

Stop the lisp repl in emacs

> ,quit

Surroundings

List of available functions

[???]

Last three items in result history (most recent first)

> *
> **
> ***

Last three items in result history (most recent first) as a list of all values

> /
> //
> ///

Last three items in command history (most recent first)

> +
> ++
> +++

Cycle though command history (previous, next item)

M-p
M-n

Search command history for things that start with search

> search M-p

Available Packages & Quicklisp

List all loaded packages

> (list-all-packages)

List all packages imported into a package

> (package-use-list (find-package 'package))

List of all available systems in the quicklisp repository

> (ql:system-list)

Search the list of systems

> (ql:system-apropos search)

Install and load a system

> (ql:quickload 'system)

Contents of a loaded package

> package:<tab>

Contents of a package, including internal symbols

> package::<tab>

Symbols and Objects

Is symbol in use?

> (boundp 'var)

Is symbol used in the function namespace?

> (fboundp 'var)

List all of the symbols in the current namespace

> (apropos "" *package*)

Originating package of a symbol

> (symbol-package 'var)

Search for thing in the symbol list (with optional package specifier)

> (apropos "thing" 'package)

Docstring

> (describe var) or C-c C-d d on point

Type of an object

> (type-of var)

Inspect item at point

C-c C-v C-i
Inspector commands
<enter> Inspect or act on the item at point
l Return from an inspection
<tab> Jump to next inspectable
Shift-<tab> Jump to previous inspectable
d Describe
e Evaluate an expression
v Toggle verbose mode
q Quit
p Pretty print object at point
. Jump to source
M-<enter> Store value at point in '*' for access in REPL

Another inspector

> (inspect var)

Inheritance tree for a class

M-x slime-browse-classes

List methods specializing on a class

M-x slime-who-specializes

Paths, locations, config files

Lisp executable location

M-: inferior-lisp-program

Version and variety of Common Lisp

> (lisp-implementation-version)
> (lisp-implementation-type)

Operating system and machine info

> (software-version)
> (machine-version)

Show the recommended folder for your projects

> ql:*local-project-directories*

Location of a specific system

> (ql:where-is-system 'system)

Name of start up configuration file for your lisp

> (ql-impl-util::init-file-name-for (lisp-implementation-type))

Code navigation

Jump to the definition of the item at point

M-.

Return from jump

M-,

List callers of a function

C-c <

List functions that a function calls (callees)

C-c >

Show the references, bindings or assignments of the global variable at point

C-c C-w r C-c C-w b C-c C-w s

Look up documentation for the symbol at point in the Common Lisp Hyperspec

C-c C-d h

Note: only for symbols defined in the Common Lisp standard

Macros

Examine a macro expansion

Given the following loop macro invocation:

(loop for i from 1 to 3 do (print i))

This will show the expansion:

(macroexpand-1 '(loop for i from 1 to 3 do (print i)))

Explore the currently available reader macros

> (inspect *readtable*)

Note: not user friendly

Crashes and errors

Stop a running task

C-c C-c

Getting back to normal from the debugger

q - or select [Abort]