Question

Here is the back story skip to the bottom if you do not care and only want to see the question.

So I have been playing around in LISP for a little while. Some basic functions, some classes ,and file IO. When I run across this article:

http://www.adampetersen.se/articles/lispweb.htm

And I am excited to try and use lisp for a web application. I go and download the packages, but for the life of me do not know how to load them into my Allegro IDE.

Hmm... ok, well the hunchentoot site says a lot of the basic packages are in LispWorks. So I download that. Still not sure how to get the source for the packages that I downloaded into these IDEs. They seem to have binaries of the packages?

Oh well maybe ill switch to my ubuntu server and apt-get all the packages and setup slime (i have not used it before because I just wanted to learn lisp. Learning emacs and lisp at the same time seemed real daunting). I apt get all the packages needed and load up slime and again same problem there aren't available.

I dig around some more and see this program called ASDF. It looks like ASDF is some kind of package builder for lisp? I don't know it seems confusing. I'm about to give up at this point.


If you are still reading this here is my question.
1. How do I load the source for these packages into my lisp environment. trying to learn lisp hasn't been too hard but the information about the environments has been sparse. Do I need to build the packages I download with ASDF.
2. Is there a simple way for someone to just get up and running in lisp without having to speed a large amount of time upfront learning all the tools?

Was it helpful?

Solution

Hmm... ok, well the hunchentoot site says a lot of the basic packages are in LispWorks. So I download that.

This just means that the author has written a lot of Lispworks-specific code in Hunchentoot. It does not mean that Hunchentoot only works on Lispworks.

Still not sure how to get the source for the packages that I downloaded into these IDEs.

You need to use ASDF.

They seem to have binaries of the packages?

That's unlikely.

Oh well maybe ill switch to my ubuntu server and apt-get all the packages and setup slime > (i have not used it before because I just wanted to learn lisp. Learning emacs and lisp at the same time seemed real daunting).

Don't do it then. You don't need to use Emacs or Slime.

I apt get all the packages needed and load up slime and again same problem there aren't available.

For quick results try clbuild: http://common-lisp.net/project/clbuild/

I dig around some more and see this program called ASDF. It looks like ASDF is some kind of package builder for lisp? I don't know it seems confusing.

ASDF is a bit like a Makefile for Common Lisp applications.

I'm about to give up at this point.

That's about the worst thing you could so (at this or any other point). I'm glad you have decided to post your problems here instead.

  1. How do I load the source for these packages into my lisp environment. trying to learn lisp hasn't been too hard but the information about the environments has been sparse. Do I need to build the packages I download with ASDF.

clbuild should give you all you need, but here are some hints if you don't want to use it:

  1. CLISP, SBCL: ASDF is part of your Lisp. Run (require :asdf). Lispworks, Allegro: you need to download and load ASDF. Save asdf.lisp somewhere then run (load "/path/to/asdf.lisp").
  2. For every library/application ("system" in ASDF speak) you need to download und unpack it to some place. Repeat until all dependencies are satisfied. Note down these places (directories).
  3. For every place from step #2 add the place to the ASDF registry: (push "/path/to/dir/" asdf:*central-registry*). Don't forget the trailing slash.
  4. Load the system using (asdf:oos 'asdf:load-op :system-name).
  1. Is there a simple way for someone to just get up and running in lisp without having to speed a large amount of time upfront learning all the tools?

See above -- use clbuild.

OTHER TIPS

The quickest way in Ubuntu is to use the packages included in that distribution. It is "ok" if you just want to try some things, but these versions are often comparatively old. I would recommend the packages sbcl and slime. If you don't know emacs yet, you can get into that quite fast through its built-in tutorial (C-h t (press Control-h, release, then press t)).

You can then start emacs, start slime (through M-x slime), open a lisp file (C-x C-f ~/lisp/first-try.lisp), and you're ready to go. As a tutorial for Lisp, I think that Practical Common Lisp is a very nice book, and it's freely available.

Now, when you have come to like Lisp, you might want more up to date packages. I would recommend to use clbuild for that (see the link for further information, including FAQ). You can then also build a new sbcl (bootstrapped by the distribution's version).

ASDF, by the way, is only a system definition facility. It doesn't know how to download packages, it only knows how to load systems into a running Lisp image. In other words, it just solves the problem of automatically loading the multiple files that some "system" (library) consists of in the right order. The newest versions allow loading a package (after it is installed, e.g. through clbuild) with a simple

(asdf:load-sys 'foo)

Older versions show ASDF's internal concept of operations:

(asdf:operate 'asdf:load-op 'foo)

The above load-sys is a shorthand for this common use case. Further information (one could say, all you need to know about it) is at the ASDF Getting Started guide. ASDF is also included in SBCL.

When you load a source file, it is automatically compiled (producing .fasl files (fast-load)) so that loading is much faster next time.

Probably one of the fastest ways to get started is to use Lisp in a Box (or a spinoff like LispBox). These are full sets of everything you need.

You could also try the Lisp Resource Kit, which is a bootable CDROM with Lisp tools and documentation, all already set up for you. Just put it into your CDROM drive and boot!

All of these answers are good, however they've become a little outdated with the new popularity of Quicklisp. Very loosely speaking, quicklisp is the package manager to asdf's make. Once Quicklisp is installed on a system, you can use (ql:quickload "name of lisp library") to load that library into your lisp environment, including downloading it and any of its dependencies if required. For example, to download, install, and load Hunchentoot and all of its dependencies, use (ql:quickload "hunchentoot"). In later lisp sessions, calling (ql:quickload "hunchentoot") again will simply load the version already downloaded and installed, making ql:quickload a simple way to load any library available locally or remotely. To install Quicklisp, I refer you to quicklisp.org.

More detailed explanation

Lisp works a little differently from other languages when it comes to libraries. The first thing to know is that the language itself provides almost no library functionality- it has load (which goes through and runs each line in a file as if you'd typed them at the REPL) and compile-file (which creates a "fast load" file, a precompiled version of the file which loads and can perform much faster). Using just what the core language provides, in order to load a library you have to go to each of its files and load it (or (load (compile-file "filename")) it, for better load speed/performance). This got tedious, so a variety of libraries were created for managing the loading of libraries, and at the moment asdf is king (so much so that many lisp implementations actually bundle it). In asdf terminology, libraries are called "systems" and .asdf files describe all of the metadata involved in loading them- the systems they depend on and what order to load files in, mostly, but they still can get quite complex. Quicklisp, then, sits on top of asdf. Basically, when asdf discovers that it cannot locate a system, Quicklisp steps in and checks to see if that system is available from one of Quicklisp's online repositories, and if so downloads it and has asdf continue on its way. ql:quickload is basically just a wrapper around the asdf machinery for loading a system that enables quicklisp to help out as needed.

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