Site icon ni18 Blog

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?

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?

Quicklisp isn’t built-in—you install it once, and it lives in your home directory (e.g., ~/quicklisp/).

How They Work Together


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:

Every new session starts from scratch—unless you take steps to change that.

Why Repeat It?

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

2. Using a Saved Image

3. Auto-Loading Setup

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

Method 2: Add Commands to Your Init File

  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!

Method 3: Save a Core Image

  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.

Method 4: Use a Script

  ;; 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.

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

Cons

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:

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.

Exit mobile version