Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 760
deadghost Avatar asked Oct 31 '13 22:10

deadghost


2 Answers

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 <[email protected]>"
  :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.

like image 83
deadghost Avatar answered Oct 05 '22 21:10

deadghost


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

like image 30
Vsevolod Dyomkin Avatar answered Oct 05 '22 21:10

Vsevolod Dyomkin