Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use packages installed by quicklisp?

I've installed the CL-PNG package using quicklisp.

(ql:quicklisp 'png)

Now I want to define my own package which depends on the CL-PNG package. Like so:

(defpackage :FOO
  (:use :CL :PNG)
  (:export :BAR))

When compiling it I get this error:

The name "PNG" does not designate any package.
   [Condition of type SB-KERNEL:SIMPLE-PACKAGE-ERROR]

It seems that I have to call (require :PNG) on the REPL before compiling my package.

What do I have to do to make the CL-PNG package available for the compiler without manually call require on the REPL?

UPDATE: I'm using SBCL.

like image 731
Jan Deinhard Avatar asked Jun 23 '12 17:06

Jan Deinhard


People also ask

How to load quicklisp?

If you want Quicklisp to always be loaded in your Lisp sessions, run (ql:add-to-init-file) : this adds the right stuff to the init file of your CL implementation. Otherwise, you have to run (load "~/quicklisp/setup. lisp") in every session if you want to use Quicklisp or any of the libraries installed through it.

How do I install Quicklisp on Mac?

Download and install Quicklisp (It's in beta at the time this was written, but it's fully functional and awesome). Download the install file (http://beta.quicklisp.org/quicklisp.lisp at the time of writing) and save it to disk somewhere easy to find. That'll download the rest of the system and get it set up for you.


1 Answers

You confuse two separate notions: a system and a package. A package is defined by Common Lisp standard and it's a collection of symbols, a way to control their visibility and usage. A system is not defined by the standard, it's a notion introduced by ASDF, which is a collection of metadata to manage files inter-dependencies in a single project in order to be able to properly compile and load it. Quicklisp is built on top of ASDF to provide a way to distribute projects, described in the form of ASDF systems.

So when you install (quickload) a system, called PNG, this doesn't mean, that this system has a package, called PNG. Does the system define any packages (usually it defines one, or even several of them) and how they are called is at the discretion of its author. Most of the projects will have package.lisp or packages.lisp files, where their packages are defined.

But in the case of CL-PNG system you're loading, it actually defines the package PNG, and it should be available in the running process after you quickload it. But you should somehow load it every time you start your Lisp system. ASDF provides a means to define a dependency on CL-PNG system, so that you can just load only your own system, and all of the systems it depends on will be loaded automatically, making available all packages you want to use.

like image 115
Vsevolod Dyomkin Avatar answered Oct 05 '22 23:10

Vsevolod Dyomkin