Common Lisp
Installing Common Lisp and SBCL on Ubuntu in TIDE
Common Lisp
Common Lisp is a powerful, standardized, multi-paradigm programming language famous for its dynamic REPL-driven development, hygienic macro system, condition system, and high performance. Steel Bank Common Lisp (SBCL) is the premier high-performance compiler implementation.
Installation
You can install SBCL natively on Ubuntu via APT, along with Quicklisp, the standard library package manager for Common Lisp.
Option 1: Installing SBCL via APT
Update your package lists and install SBCL:
apt update
apt install -y sbcl cl-launchOption 2: Installing Quicklisp (Library Manager)
Quicklisp makes downloading and managing Common Lisp packages seamless.
- Download the official Quicklisp bootstrap script:
curl -O https://beta.quicklisp.org/quicklisp.lisp- Run the non-interactive Quicklisp installer:
sbcl --no-sysinit --no-userinit --load quicklisp.lisp \
--eval '(quicklisp-quickstart:install :path "~/.quicklisp")' \
--eval '(ql:add-to-init-file)' \
--quitQuicklisp will now automatically load whenever you launch sbcl.
Verification
Confirm that SBCL is installed:
sbcl --versionWriting and Running Code
Interactive REPL
Start the SBCL interactive session:
sbclEvaluate expressions inside the REPL prompt:
* (format t "Hello, World from Lisp REPL!~%")
Hello, World from Lisp REPL!
NILType (quit) or (sb-ext:exit) to exit.
Running a Lisp Script File
Create a source file named hello.lisp:
(defun main ()
(format t "Hello, World from Common Lisp in TIDE!~%"))
(main)Run the script directly via SBCL CLI:
sbcl --script hello.lispBuilding a Standalone Native Executable
You can dump the active Lisp image into a fast, standalone binary file.
Create a file named make-executable.lisp:
(defun main ()
(format t "Hello, standalone Lisp executable!~%")
(sb-ext:exit))
(sb-ext:save-lisp-and-die "hello"
:toplevel #'main
:executable t)Execute SBCL to generate the executable binary:
sbcl --load make-executable.lisp
./hello