Do You Need to Run ASDF:load-system and ql:quickload Every Time You Work in Lisp?

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!


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 .asd files.
  • 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., ~/.sbclrc for SBCL) to load systems automatically.
  • Steps:
  1. Open ~/.sbclrc in a text editor.
  2. Add lines like:
    lisp (require :asdf) (ql:quickload :cl-ppcre) ; Load a library (asdf:load-system :my-app) ; Load your project
  3. 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):
  1. Start SBCL: sbcl.
  2. Load what you need: (ql:quickload :hunchentoot).
  3. Save it: (sb-ext:save-lisp-and-die "my-image.core").
  4. 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

  1. Start SBCL: sbcl.
  2. Load Quicklisp (if needed): (load "~/quicklisp/setup.lisp").
  3. Load Hunchentoot: (ql:quickload :hunchentoot).
  4. Define your app:
   (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 8080))
  1. Test it at http://localhost:8080.

You’d repeat steps 3-4 every new session.

Streamlined Way

  1. Edit ~/.sbclrc:
   (load "~/quicklisp/setup.lisp")
   (ql:quickload :hunchentoot)
  1. 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

MethodEffortBest ForReload Needed?
Manual CommandsLowOne-off tasksYes
Keep REPL OpenNoneLong sessionsNo
Init FileMediumDaily workflowsNo
Core ImageHighStable projectsNo
ScriptMediumApp launchesNo

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

  1. Download from quicklisp.org.
  2. Run (quicklisp-quickstart:install) in your Lisp REPL.
  3. Add (load "~/quicklisp/setup.lisp") to your init file.

Use ASDF

  1. It’s already in SBCL or CCL—no install needed.
  2. Create a .asd file for your project (check ASDF’s docs).
  3. 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.

Leave a Comment