In common lisp, anything that's named (a variable, a function, a macro) is attached to a symbol. In this case, you have a function which is attached to the symbol make-pqueue
. Symbols are separated from each other using packages. This keeps collisions to a minimum and also allows for things like internal variables/functions that aren't exported by the package.
Sounds like you need to do one of three things:
- Use the package name before the function:
(priority-queue:make-pqueue #'<)
. This method is good if you want people reading your source to know exactly what code is being run. however, it can get cumbersome if you call the package many times. Use the
priority-queue
package in the current package you're in:(use-package :priority-queue) (make-pqueue #'<)
What this does is import every exported symbol from the
priority-queue
package into the current package you're in (most likelycl-user
). While this is good for testing, you generally want to create your own package. See next item.Define your own package that uses priority-queue:
(defpackage :queue-test (:use :cl :priority-queue)) (in-package :queue-test) (make-pqueue #'<)
Defining your own packages seems like a lot of work at first, but you'll start to like the separation you get, especially if you start integrating different pieces of your code together.