Search code examples
dependencieslispcommon-lispquicklispasdf

How do I manage common lisp dependencies?


What's the lisp equivalent of a pip requirement file, ruby gemfile, node package.json, etc? I'm not entirely sure how asdf and quicklisp relate if those are the proper things to use.


Solution

  • A .asd file is a requirements file. Use quicklisp to install requirements.

    Use ASDF to define a "system". Create a my-system.asd file.

    (asdf:defsystem #:my-system
      :serial t
      :description "Describe my-system here"
      :author "My Name <my.name@example.com>"
      :license "Specify license here"
      :depends-on (#:hunchentoot
                   #:cl-who)
      :components ((:file "package")
                   (:file "dispatch")))
    

    This creates the system named #:my-system. I'm not actually sure what the # denotes as I've seen system definitions without it in source code. Only the first line is required. :depends-on tells ASDF to load other systems before this new system definition is processed. In this case it loads #:hunchentoot and #:cl-who. :components load specific files. package.lisp and dispatch.lisp are loaded. :serial t tells it to load it in order. This is important if say dispatch.lisp depends on something in package.lisp such that package.lisp needs to be loaded first.

    Use quicklisp to download and install the dependencies in :depends-on. Run (ql:quickload "my-system").

    I haven't seen any sign of versioning.