Thursday, 25 March 2010

Clojure now in java-overlay

I recently received commit access to Gentoo’s Java overlay, and so I took the chance to commit my ebuilds for Clojure and Clojure-contrib. This means that Clojure is now a step closer to becoming a standard part of Gentoo.

The following step-by-step guide should help you get started. Note that the following instructions assume you are using the standard Gentoo package management tools. If you use some other system, such as Paludis, you will need to refer to the documentation for your preferred manager about how to add overlays and keyword packages.

In order to get started, you will have to first make sure that the Java overlay is installed on your system.

Installing the Java overlay on Gentoo

In order to install Clojure, you will need to install layman according to the instructions in the User’s Guide. Be sure to enable the subversion USE flag. Once you have layman installed, you should be to execute layman -L and see a line similar to the following:

* java-overlay              [Subversion] (svn://overlays.gentoo.org/proj/java/java-overlay/

Once layman is installed, add the Java overlay using layman -a java-overlay. After a lengthy checkout, you should see the line:

* Successfully added overlay "java-overlay".

Congratulations, you now have the Java overlay installed. Now you can move onto installing Clojure.

Emerging Clojure

With the Java overlay installed, the Clojure and Clojure-contrib ebuilds are now available through portage.

Note that Clojure is currently keyworded ~amd64 and ~x86. This means that if you are running on the stable branch of Gentoo (the default), or if you are not using an amd64- or x86-based computer, you will need to take a few extra steps. The good news is that if you can run Java on your system, you should be able to run Clojure as well1.

With the proper keywording done, installing Clojure is as simple as emerge clojure. Note that both 1.0.0 and 1.1.0 versions of Clojure are available, and you can install them concurrently using Gentoo’s slot mechanism. By default, portage will install the latest version (1.1.0 slotted as 1.1), but you can force installing version 1.0 by using slot ‘0’, i.e. emerge clojure:0.

The above instructions also apply for installing Clojure-contrib—simply emerge clojure-contrib or emerge clojure-contrib:0.

Running Clojure

With Clojure emerged, running the REPL is as simple as typing clojure or clojure-1.1, depending on which version you are using.

Including Clojure-contrib manually

Note that, by default, the Clojure commands will not include Clojure-contrib in your class path. You can do this manually on the command line by invoking Clojure using one of the following commands:

For clojure-contrib 1.1.0:

CLASSPATH=$(java-config -p clojure-contrib-1.1) clojure-1.1

For clojure-contrib 1.0.0:

CLASSPATH=$(java-config -p clojure-contrib) clojure
Including Clojure-contrib automatically

The way I prefer to run Clojure is to have the launcher script automatically include Clojure-contrib. This can be done by customizing the launcher’s class path by adding files to the .gentoo/java-config-2/launcher.d directory under your home directory2.

For version 1.1.0:

% echo 'gjl_package="clojure-contrib-1.1"' > .gentoo/java-config-2/launcher.d/clojure-1.1

For version 1.0.0:

% echo 'gjl_package="clojure-contrib"' > .gentoo/java-config-2/launcher.d/clojure

Having accomplished the above, Clojure-contrib should now be available from the launcher. For example, you could try:

% clojure-1.1
Clojure 1.1.0
user=> (use 'clojure.contrib.str-utils)
nil
user=>

Final Thoughts

This is merely the first step towards getting better Clojure support in Gentoo. Some of the next few things I am considering doing include:

  • Add ebuilds for editor integration with Clojure. There is a VimClojure ebuild in java-experimental that I will soon be moving to java-overlay. Although I don’t use other editors, I think that Emacs integration would be good, too.
  • Add some sort of eselect-based method to automate much of the above. I envision a script that will manage it so that typing clj will launch the appropriate version of Clojure and include Clojure-contrib if desired.
  • Package more Clojure applications and libraries.

I am working towards become a full-fledged Gentoo Developer. Once I get there, I will have a better opportunity to help get Clojure-related packages into the main tree and help make Gentoo a very Clojure-friendly Linux distribution.

In the meantime, I appreciate any user feedback. You can find me as ‘sattvik’ on Freenode on #gentoo-java and #clojure. Of course, you can also leave comments on this site.

Footnotes
  1. If you do get Clojure working on non x86 or amd64 system, please make a note of it in the bugs for Clojure and Clojure-contrib.
  2. Alternatively, you can add these files to /etc/java-config-2/launcher.d/ to have the effect system-wide.

Now with comments

I am happy to announce that Deep Blue Lambda now supports comments and TrackBacks. For the moment, they are moderated, so it may take a bit of time before you see your comment or TrackBack. My intention is to get rid of moderation once I have implemented some other anti-spam measure.

I will continue to add new features to the site as time permits. Unfortunately, it seems that the original Perl-based version of Blosxom has fallen into disuse, so it has become harder to find plug-ins that implement the types of features people expect in web log software these days.

So, please feel free to leave a comment to let me know what else you’d like to see on this site.

Thursday, 18 March 2010

Teaching Clojure at RubyLearning

RubyLearning is a web site that offers on-line courses for people wanting to learn Ruby. They recently announced Clojure 101, an introductory course on Clojure. I will be assisting Michael Kohl in teaching the course by helping write course materials and answering questions on the course forums.

If you are interested in learning Clojure, this is an excellent opportunity. You will have the chance to interact with the other assistant teachers and hundreds of other participants. Best of all, it is free of charge.

Please, check it out and join if you are interested.

Wednesday, 17 March 2010

Welcome to Deep Blue Lambda

Allow me to welcome you to Deep Blue Lambda. My name is Daniel Solano Gómez, an independent software developer in Houston, Texas. The purpose of this web site is to help me communicate and network with fellow professionals around the world.

On this web site I will be posting:

  • Technical documentation I believe may be of use to others,
  • Information about my open source projects,
  • Announcements about talks or appearances that I make, and
  • Any other thoughts or musings regarding the state of the art.

Unfortunately, I am launching this site a bit sooner than I had anticipated, so for the moment it is a bit lacking on both features and content. However, I will remedy this in the coming days.