Question

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.

Was it helpful?

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.

OTHER TIPS

First of all, pip's requirements.txt is very different from rubygem or node's package.json: the former specifies just the dependencies, while the latter ones describe the package, including its dependencies.

Python's pip actually also relies on the similar package description format which is called "eggs".

A pretty much direct equivalent of a rubygem is ASDF defsystem form, usually placed in a file <system-name>.asd ("system" is the Lisp's term for what may be called package, module or library in other languages - see here for a more detailed explanation).

The two major differences are:

  • ASDF also allows to specify how to build (and also load, test etc) the system (somewhat equivalent to a makefile) — AFAIK, there's no such notion in rubygems or node whatsoever

  • Unlike gems or node, ASDF doesn't provide a mechanism to download and install the package. This is where quicklisp comes in — it deals with fetching ASDF systems. But ql is not the only way here: historically there were other approaches for installing ASDF libraries, including ASDF-Install and clbuild, and others may come up in the future

Qlot

For the relation with ASDF and Quicklisp the other answers give a nice approach.

I want to remark that now you can use a common lisp library quite similar to the ones pointed, that is available at quicklisp an is Qlot. It is used to specify project-local dependencies. It is pretty similar to bundle and gemfile in ruby.

Quicklisp bundles

Also introduced in 2015-04-28 you can use quicklisp bundles Quicklisp library bundles are self-contained sets of systems that are exported from Quicklisp and loadable without involving Quicklisp.

There is no one-to-one equivalent to those mentioned above. However, ASDF + Quicklisp combination comes pretty close.

With ASDF you define your systems (modules if you will) -- packaging your lisp files in a coherent way, and you declare your dependencies. Quicklisp is an online repository of sources for these systems. When you load a system with Quicklisp, it will download these dependencies and load them for you.

Now I'm not sure if there is such thing as versioning..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top