Can you help me to rapidly learn common lisp, emacs, and SLY? Here’s what I want to do and want a short manual for:

  1. A brief description of SBCL and what the binary does
  2. A brief description of quicklisp and how the system works
  3. A brief description of SLY (the EMACS repl) and where it fits in
  4. A hello-world example written with sly and emacs
  5. Showing how to compile this hello-world to an executable on Debian

All content below is the response to this request.

Common Lisp, SBCL, Quicklisp, and SLY: A Beginner’s Guide

1. What is SBCL?

SBCL (Steel Bank Common Lisp) is a high-performance Common Lisp compiler and runtime. The sbcl binary is used to:

  • Start an interactive Lisp REPL (Read-Eval-Print Loop).
  • Compile and run Lisp programs.
  • Build standalone executables.

To install SBCL on Debian:

sudo apt install sbcl

You can start the REPL by typing:

sbcl

2. What is Quicklisp?

Quicklisp is a package manager for Common Lisp, similar to pip for Python. It simplifies library management.

Installing Quicklisp

Run the following in your terminal:

curl -O https://beta.quicklisp.org/quicklisp.lisp
sbcl --load quicklisp.lisp

Then, in the SBCL REPL:

(quicklisp-quickstart:install)
(ql:add-to-init-file) ;; Makes Quicklisp available in future sessions

Using Quicklisp

Load a library (e.g., cl-ppcre for regex):

(ql:quickload "cl-ppcre")

3. What is SLY?

SLY (Superior Lisp Interaction Mode for Emacs) is an Emacs extension for working with Lisp. It provides:

  • A powerful REPL.
  • Code navigation and debugging.
  • Integration with SBCL.

Installing SLY in Emacs

  1. Open Emacs and run:
    M-x package-install RET sly RET
    
  2. Add this to your ~/.emacs:
    (setq inferior-lisp-program "sbcl")
    (require 'sly)
    
  3. Start SLY with:
    M-x sly
    

4. Hello-World in SLY and Emacs

  1. Open Emacs.
  2. Create a file hello.lisp:
    (defun hello-world ()
      (format t "Hello, world!~%"))
    
  3. Load the file in SLY:
    M-x sly
    
    Then, inside the SLY REPL:
    (load "hello.lisp")
    (hello-world)
    

5. Compiling to an Executable on Debian

To compile your Lisp program into a standalone binary:

  1. Create hello.lisp with:
    (defun main ()
      (format t "Hello, world!~%"))
    
    (sb-ext:save-lisp-and-die "hello" :toplevel #'main :executable t)
    
  2. Compile it with SBCL:
    sbcl --script hello.lisp
    
  3. Run the generated binary:
    ./hello
    

This should get you started! Let me know if you need refinements or additions. 🚀