Welcome to my site!Stories by T. Gene DavisPoetry by T. Gene DavisMagazine of fiction and poetry by T. Gene DavisAbout T. Gene Davis

Clojure Links

My newest thing is Cojure. I am determined to learn it, so that I can do AI research in it. I am making the leap that it will be well suited to AI research, because it is a Lisp like language.



Pretty Clojure for HTML

Here is c2h, a work in progress. This command line tool adds color to Clojure and prepares it for display on web pages.





Passing User Events to Clojure from Java GUIs

Refer to this page for information on integrating a Java view with a Clojure controller.





Creating a 'clojure' Command on Mac OS X

Here are some quick notes on getting Clojure up and running on Mac OS X.

  1. Download Clojure and JLine. (JLine makes Clojure behave better in the console.)

  2. Unzip bother Clojure and JLine.

  3. Place the clojure.jar and jline.jar in the /Library/Java/Extensions/ folder. The names of the two jars likely include version numbers. Don't let that throw you.

  4. Now open the Terminal application. Use the modified commands below for running main or Repl.
    • java jline.ConsoleRunner clojure.main some_file.clj
    • java jline.ConsoleRunner clojure.lang.Repl

  5. Use control-d to leave the REPL environment.

Now that is very nice and all, but you can do better still! Wouldn't it be nice to just type clojure to execute Repl and clojure some_file.clj to execute a script with main?

  1. Open Terminal and cd to the /usr/bin/ folder.

  2. Type sudo pico clojure to create a clojure command. You will need to enter your admin password. Pico opens a new file named 'clojure' for editing.

  3. Populate your new clojure command with the following code...

    #!/bin/bash
    # created by T. Gene Davis 
    # http://t.genedavis.com/library/clojure/
    
    NUMBER_OF_ARGS=$#
    ARGS_FOR_MAIN=0
    
    if [ $NUMBER_OF_ARGS != $ARGS_FOR_MAIN ]; then
    
    java jline.ConsoleRunner clojure.main $@
    
    else
    
    java jline.ConsoleRunner clojure.lang.Repl
    
    fi
    
    exit
    

  4. Set the permissions of your new clojure command to match the other commands in the directory. Type sudo chmod 755 clojure and enter your admin password.

Now from the Terminal, type clojure for the REPL, and type clojure some_script.clj to execute a file called some_script.clj!





Here are some links I'm putting together.


Clojure Home - Just what it says. This is the source for all things Clojure

Clojure Tutorial - for people without a lisp ;-)

Model-View-Controller GUI in Clojure - Clojure Swing example.

Chaos Theory vs Clojure - Chaos Theory animated in 80 lines of clojure. Cool.

ociweb clojure article - "A fairly comprehensive introduction to the Clojure"

Rifle-Oriented Programming with Clojure - Nice explanation of Clojure from an OOP point of view.

Clojure Decompiled - "What actually does execute when you run a Clojure function?"

Basic Clojure Setup - Three part Clojure setup tutorial for OS X.

Setting Up Clojure for Mac OS X Leopard - just what the title says.

Ant Builds - Building Clojure apps using Ant.

AnotherClojureBox - Another way to edit and run Clojure.

clojure-dev - Need Eclipse syntax coloring for Clojure? Check here.

Clojure At Eclipsecon - Clojure language info mentioned at 2009 Eclipse convention.

Programming Clojure - A book, and it's page.


Pong! - 200 lines of Clojure make this classic game come to life.

Conway's Game of Life - Clojure and Swing implementation of John Conway's "Game of Life".

Back propagation algorithm in Clojure - Neural networks.

A Field Guide to Genetic Programming - Also not about Clojure, but interestes related to my reasons for studying Clojure. Related Clojure code here.

Flipping Coins with Clojure - Patterns in an infinite flip sequence.

Clojure Agents - "A gentle introduction to agents."

Pattern Matching In Clojure - What the title says.

Why Functional Programming Matters - Not about Clojure, per se. BTW, Clojure is a functional language.

The Promises of Functional Programming - Article in Computing in Science and Engineering magazine.

Functional Programming for the JVM - May 15, 2009 presentation by Mark Volmann.

Challenge your Java assumptions - JavaWorld article about Clojure.


Clojure performance tips - Repost from the mailing list.

Clojure Performance Blog - some tips about improving performance in Clojure.

Monads Part 1, Part 2, Part 3, Part 4 - A Monad Tutorial For Clojure Programmers.

Monads in Clojure Part 1, Part 2 - Title says it all.

API Usage - example code for using the clojure API

Clojure Examples - "a collection of examples of clojure code"

A Clojure Cookbook - another cookbook

Learning Clojure and Emacs - getting started with Clojure using emacs


Further Reading - Links the Clojure enthusiasts may find interesting.

Clojure Categorized - functions and macros organized by category.

Vala and Clojure - Comparing these two languages.

Bay Area Clojure Meetup - Clojure related blog.

Implementing AltLaw.org in Clojure - Video, ... very big video, ... from 9 June 2009.