If youโre diving into Common Lispโa powerful, flexible programming languageโyouโve likely come across commands like (ASDF:load-system :xxxx) and (ql:quickload :yyyy). Theyโre key to loading libraries and systems, but hereโs the big question: Do you have to run them every single time you start working? If youโre new to Lisp or just curious about streamlining your workflow, this guide is for you.
In this beginner-friendly article, weโll explain what these commands do, why theyโre used, whether you need to run them repeatedly, and how to make your Lisp experience smoother in 2025. Weโll break it all down in simple English, with practical tips, examples, and the latest updates. Letโs get started!
Table of Contents
What Are ASDF and Quicklisp?
Before we answer the main question, letโs get the basics down. These tools are the backbone of managing code in Common Lisp.
What Is ASDF?
- Full Name: Another System Definition Facility.
- What It Does: ASDF is like a project manager for your Lisp code. It loads and organizes โsystemsโ (think libraries or your own projects) by following instructions in
.asdfiles. - Example: If your project is called
:my-app,(ASDF:load-system :my-app)pulls in all its files and dependencies.
ASDF is built into most modern Lisp implementations (like SBCL or CCL), so itโs ready to go out of the box.
What Is Quicklisp?
- What It Is: A package manager for Common Lisp, like npm for JavaScript or pip for Python.
- What It Does: Quicklisp downloads and installs libraries from its online repository, then loads them with
(ql:quickload :yyyy). - Example:
(ql:quickload :cl-ppcre)grabs a popular regex library and makes it usable.
Quicklisp isnโt built-inโyou install it once, and it lives in your home directory (e.g., ~/quicklisp/).
How They Work Together
- ASDF handles the loading part.
- Quicklisp fetches libraries and uses ASDF to load them.
- Together, theyโre your toolkit for managing Lisp projects.
Do You Have to Run Them Every Time?
Hereโs the short answer: Not always, but it depends on how you work. Letโs unpack this step-by-step.
The Default Behavior
When you start a fresh Lisp session (say, by launching SBCL in your terminal), the environment is empty. It doesnโt remember what you loaded last time. So:
- If you need a library like
:cl-ppcre, youโll run(ql:quickload :cl-ppcre)to get it. - If youโre working on your own project,
(ASDF:load-system :my-app)loads it fresh.
Every new session starts from scratchโunless you take steps to change that.
Why Repeat It?
- Session-Based: Lisp runs in a REPL (Read-Eval-Print Loop). When you close it, everything resets.
- Manual Control: Lisp doesnโt assume what you needโit waits for your instructions.
- Updates: Running
(ql:quickload)ensures youโve got the latest version of a library.
So, yes, if you restart your Lisp environment, youโll need to reload systems and libraries. But there are ways to avoid typing these commands over and over. Letโs explore!
When You Donโt Need to Reload
You donโt always have to run (ASDF:load-system) or (ql:quickload) every time. Hereโs when you can skip it:
1. Within the Same Session
- Once you load a system or library (e.g.,
(ql:quickload :hunchentoot)for a web server), it stays loaded until you exit the REPL. - Keep your REPL open, and youโre good to goโno need to reload.
2. Using a Saved Image
- Some Lisp implementations let you โsaveโ your environment (called a core image) with everything pre-loaded.
- Restart with that image, and your libraries are readyโno commands needed.
3. Auto-Loading Setup
- Configure your Lisp to load systems automatically when you start. More on this later!
So, the real question is: How often do you restart your Lisp session? If itโs rare, you might not mind running these commands. But if itโs constant, letโs optimize.
How to Avoid Repeating ASDF and Quicklisp Commands
Tired of typing (ASDF:load-system :xxxx) or (ql:quickload :yyyy) every time? Here are practical ways to streamline your workflow in 2025.
Method 1: Keep Your REPL Running
- How It Works: Donโt close your Lisp session. Use a terminal or editor (like Emacs with SLIME) to keep it alive.
- Pros: Everything stays loadedโperfect for long coding sessions.
- Cons: Uses memory; might crash if youโre not careful.
Method 2: Add Commands to Your Init File
- How It Works: Edit your Lisp startup file (e.g.,
~/.sbclrcfor SBCL) to load systems automatically. - Steps:
- Open
~/.sbclrcin a text editor. - Add lines like:
lisp (require :asdf) (ql:quickload :cl-ppcre) ; Load a library (asdf:load-system :my-app) ; Load your project - Save and restart SBCLโeverythingโs ready!
- Pros: Saves time; customizes your setup.
- Cons: Loads stuff even if you donโt need it.
Method 3: Save a Core Image
- How It Works: Save your Lisp state with libraries loaded, then launch from that.
- Steps (SBCL Example):
- Start SBCL:
sbcl. - Load what you need:
(ql:quickload :hunchentoot). - Save it:
(sb-ext:save-lisp-and-die "my-image.core"). - Restart with:
sbcl --core my-image.core.
- Pros: Instant startup with everything pre-loaded.
- Cons: Takes effort to update if libraries change.
Method 4: Use a Script
- How It Works: Write a script to load systems and run your app.
- Example:
;; load-stuff.lisp
(ql:quickload :cl-ppcre)
(asdf:load-system :my-app)
(my-app:start) ; Assuming your app has a start function
Run it with: sbcl --script load-stuff.lisp.
- Pros: One command does it all.
- Cons: Extra file to maintain.
These tricks cut down on repetitive typingโpick what fits your style!
Real-World Example: Loading a Web App
Letโs see this in action with a simple web server using the Hunchentoot library.
Manual Way
- Start SBCL:
sbcl. - Load Quicklisp (if needed):
(load "~/quicklisp/setup.lisp"). - Load Hunchentoot:
(ql:quickload :hunchentoot). - Define your app:
(hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 8080))
- Test it at
http://localhost:8080.
Youโd repeat steps 3-4 every new session.
Streamlined Way
- Edit
~/.sbclrc:
(load "~/quicklisp/setup.lisp")
(ql:quickload :hunchentoot)
- Start SBCLโHunchentootโs ready. Just run your app code.
See the difference? Automation saves time!
Pros and Cons of Reloading Every Time
Should you reload manually each session? Hereโs a breakdown:
Pros
- Fresh Start: No leftover bugs from old sessions.
- Latest Versions:
(ql:quickload)grabs updates automatically. - Control: Load only what you need.
Cons
- Time Sink: Typing commands slows you down.
- Repetitive: Feels tedious for big projects.
In 2025, most Lisp developers mix manual and automated approachesโload once, then tweak as needed.
Latest Tips for Lisp in 2025
As of March 07, 2025:
- Quicklisp Updates: The repository now hosts over 1,800 libraries, with monthly refreshes.
- ASDF 3.3.7: Released January 2025, itโs faster and handles dependencies better.
- SBCL 2.4.2: The latest version supports quicker startupsโperfect with core images.
Keeping your tools updated makes loading smoother.
Quick Reference Table: Loading Options
| Method | Effort | Best For | Reload Needed? |
|---|---|---|---|
| Manual Commands | Low | One-off tasks | Yes |
| Keep REPL Open | None | Long sessions | No |
| Init File | Medium | Daily workflows | No |
| Core Image | High | Stable projects | No |
| Script | Medium | App launches | No |
Pick based on your project size and habits!
How to Get Started with ASDF and Quicklisp
New to Lisp? Hereโs your quick start guide:
Install Quicklisp
- Download from quicklisp.org.
- Run
(quicklisp-quickstart:install)in your Lisp REPL. - Add
(load "~/quicklisp/setup.lisp")to your init file.
Use ASDF
- Itโs already in SBCL or CCLโno install needed.
- Create a
.asdfile for your project (check ASDFโs docs). - Load with
(asdf:load-system :your-system).
Youโre ready to roll!
Conclusion: To Load or Not to Load?
So, do you have to run (ASDF:load-system :xxxx) and (ql:quickload :yyyy) every time you work in Lisp? Only if you start fresh each session. But with tricks like init files, core images, or scripts, you can skip the repetition and focus on coding. In 2025, Lispโs flexibility lets you choose what works bestโwhether youโre building a quick script or a full app.