Eggs, eggs, eggs

Eggs are official Chicken extensions. As you can see in the Eggs Unlimited repository, there are lots of them, for all kinds of purposes: extensions to the language, object systems, testing frameworks, graphics, web, XML, and much more. (As such, the repository is not unlike Perl's CPAN, or RubyGems, or Python's Cheese Shop.)

Eggs are Chicken-specific; while some other Schemes have their own packages, they are not compatible with eggs.

These extensions are (usually) easily installed, using the chicken-setup script. You can find the full documentation here, but the short story is as follows.

Look up the egg you want in Eggs Unlimited. Let's say you don't like the fact that Chicken doesn't support the full numerical tower out of the box. So you want to install the numbers egg. Doing so is as easy as

$ chicken-setup numbers

or, if you need admin privileges, maybe

$ sudo chicken-setup numbers

(which is what I use on my Mac).

This will look for the numbers egg, download it, build it, and install it. Note that, like most package managers, chicken-setup will figure out any dependent eggs, and (if necessary) download and install them as well.

Some eggs require external libraries; for example, numbers wants to be compiled with -lgmp. Such libraries need to be installed first (e.g. via MacPorts on OS X).

In order to see which eggs have been installed, use the -l switch:

$ chicken-setup -l

I find the output a bit hard to read, because of the distance between the package name and the version. This one-liner might help:

$ chicken-setup -l | awk '{ print $1, $3 }'

This produces output that looks like this:

args 1.2
chicken-wrap 1.91
easyffi 1.91
environments 1.5
format 3.1.3
...etc...

To see detailed information about a specific egg, use the -l switch with a name, like:

$ chicken-setup -l numbers

...which will give you information about the files in the egg, the names that it exports, the release date, the version, dependencies, etc.

chicken-setup supports many more options (use the --help switch to see them), but these are among the most useful.

By the way, there's a caveat that might not be a problem for most users unless they're running on Windows without Cygwin:

"The mechanism for loading compiled extensions is based on dynamically loadable code and as such is only available on systems on which loading compiled code at runtime is supported. Currently these are most UNIX-compatible platforms that provide the libdl functionality like Linux, Solaris, BSD, Mac OS X and Windows using Cygwin."

Leave a Comment