So I wasn’t actually planning this. But I’ve been working on Patterning again in the last week or so.

There’s a new version coming.

The bad news is that it’s going to break the “API” and your existing code. 🙁

The good news is that there will now actually BE an API. A real one, made with Protocols and defrecords that should be usable directly from Java without yet another wrapper. And will hopefully be more stable in future. 🙂

So, sorry for any inconvenience. But I think it’s all going to be a lot better from here on in.

Well that was surprisingly painless.

I’m in the process of reorganizing the code for Patterning, my Clojure library that produces (visual) patterns.

Patterning was built using Quil, which is a Clojure wrapper around Processing. But I wanted to be able to call the library directly from Processing itself (Java version).

It seemed silly to create an uberjar file containing the whole of Quil and Processing, to be called from … er … Processing, so I decided to split the project into the core (pure Clojure, no Quil or Processing dependencies) and a Quil based wrapper.

I’m also, compiling the library using ClojureScript to run in the browser. (Called from Javascript). Once again this part doesn’t want any Quil / Processing dependencies.

But I was a bit stumped with how to manage some of this. My previous experience of projects that rely on other projects (git submodules) has been somewhat painful.

But it seems the Clojure (via Java) world has actually sorted this. All I needed to do was create an account over on Clojars and type :

lein deploy clojars

to put the JAR for my Patterning library there.

And so here it is.

Including it in a new project is as simple as referencing it in the project.clj file. There’s a simple test project which combines both Patterning and Quil. And here’s the very simple project.clj file. Note the patterning dependency.


(defproject com.alchemyislands/patterning_quil "0.1.0-SNAPSHOT"
:description "Quil Wrapper for Patterning library"
:url "http://alchemyislands.com"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/math.numeric-tower "0.0.4"]
[quil "1.7.0"]
[com.alchemyislands/patterning "0.3.0-SNAPSHOT"]]
:aot [patterning_quil.core]
:main patterning_quil.core
)

And that’s more or less it.

If you want to use Patterning in your own projects, just include it like that. If you still want to be using Quil, then use this as your example.

BTW: the new development for the core Patterning library is now at https://github.com/interstar/Patterning-Core