Interesting to go back to Stevey’s Blog Rant from 2006.

Quite perceptive … the ascendent Lisps today, at least the ones that have caught my attention, are Clojure and Racket. Neither of which really existed at the time he was writing (although Racket’s ancestor, Dr. Scheme did). Both of which do, indeed, have offered a layer of practicality and accessibility that perhaps other Lisps of the time lacked.

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.

Clojure is a wonderful language. The more I use it, the more I like it.

But the default error reporting is catastrophically bad, forcing you to look through screensful of Java stack-trace for the needle of a bit of code that’s actually yours.

I’m sure there are better solutions, but today I just hacked a very quick and dirty python program to filter this result, highlighting the lines that I care about.


#!/usr/bin/python

import sys
p = sys.argv[1]

for line in sys.stdin :
    if p in line :
        print '33[92m' + line + '33[0m',
    else :
        print line,

I made this code in an executable file called “colourit” in my bin directory. Now I can do this :


lein test |& colourit patterning

to, for example, highlight lines containing the word “patterning”.

So Clojure is getting Reader Conditionals ie. a way to put Clojure / ClojureScript etc. variants into ordinary source files.

It’s like .cljx files but without the separate pre-processor. Now the Clojure / ClojureScript compilers themselves will be able to pick out the variant of the code relevant to them.

Most of Patterning’s core is in .cljx format. I’m looking forward to moving to .cljc but it seems like this feature is so new (only in Clojure 1.7) I’d be better waiting a bit longer.

A few years ago I looked at some of the programs I was writing, both for public release and libraries / scripts for internal consumption, and realized that even I was confused.

I needed a new map to understand what I was doing. Hence I came up with Project ThoughtStorms. A quick and dirty overview of what I was up to in this space of wikis, personal information and knowledge management.

I think that helps. I know what I’m up to, with the legacy of my ThoughtStorms UseMod wiki and SdiDesk, my experiments with Smallest Federated Wiki, the new OWL stuff, etc. It’s still a mess, but it’s conceptually “encapsulated” in a single place.

Now I find myself with a similar situation with a number of different tries at some tools to make it easier for me to produce static web-sites. Originally there was GeekWeaver, a way for me to generate static sites quickly and easily from an OPML outline. That was a great idea … except … it got mixed up with my n00bie enthusiasm for Lisp and desire to create a powerful Lisp-like programming language.

GeekWeaver also foundered on two other issues : soon after I wrote it, there were no popular OPML outliner tools. Although Dave Winer has resolved that issue and I have, indeed, used Fargo to author GeekWeaver programs.

The other, more subtle and pernicious issue is that few people want to develop a site from scratch these days. Most people use huge frameworks with not just Javascript, but CSS, LESS etc. It really doesn’t make sense to try to use a tool which denies the file-system or the fact that you’ll want to be working with a large number of external files.

So the next time I needed to produce some quick static pages I went back to the drawing-board and came up with BootDown : a very simple Python script that lets you write text in Markdown and wraps it in a BootStrap / BootSwatch template. It’s the opposite of GeekWeaver, it isn’t trying to be a rich and clever language that lets you define your own templates, it’s just a quick way to take advantage of a lot of templates that already exist.

BootDown adds two things to conventional Markdown. A shorthand for declaring div tags. And a page separator. So you can still make a multi-page site inside a single file. And you can explicitly reference the div classes and ids you need.

More recently still, I’ve been getting into a real Lisp : Clojure. Today, that’s the language I really want to be working with. And I have a current project that again involves generating a multi-page, fairly static site. But the inputs are a little bit more complicated : some more structured data, not just text. And it makes sense to store it in an outline. So I’ve started writing Clojure code to read OPML and spit out a BootDown Markdown file, to wrap in HTML.

I can see this project starting to grow too.

And so here I am … three Python code-bases : GeekWeaver, BootDown and the OWL back-end server. Two Clojure projects : the beginnings of a library to work on OPML outlines (OPMLKit) and my unreleased code I’m writing for this current project. And some clunky pipelines to use them together. It’s starting to be another mess. And that’s why I need Project GeekWeaver : an umbrella to pull together these different strands together, at least conceptually.

There are some thoughts … would it make sense to pull at least some of the original GeekWeaver code INTO the OWL back-end server? So that “run transformations on this outline” is a standard OWL feature, and OWL becomes GeekWeaver’s built-in IDE? But what about the OWLdroid version that doesn’t have Python? Should I rewrite that code in CoffeeScript. (Or ClojureScript … a working but still fairly slow option at the moment.) BootDown “just works”. Am I better off scrapping the GeekWeaver idea altogether and just focusing on such practical solutions?

Some of this will become clearer as I work through this current site I’m making. meanwhile Project GeekWeaver is the category and (shortly) the site for the high-level overview.

Further to this story.

I tried to deploy another small Clojure library to Clojars today. And found myself being asked for the passphrase to sign my update.

You need a passphrase to unlock the secret key for
user: “phil jones
2048-bit RSA key, ID XXXXXX, created 2012-03-05

I got into a terrible confusion. Because, for the life of me, I couldn’t remember what passphrase I’d chosen to sign my Clojar last time. Had I just locked myself out of my Clojars account and the existing group and Patterning project?

A couple of hours faffing and I figured it out :

– my previous library WASN’T signed. It’s just in “Clojars Classic” and isn’t “promoted” so doesn’t require signing. That’s why I don’t remember signing it or inventing a pass-phrase.

– the reason that lein deploy was demanding a pass-phrase THIS TIME, was that in this library I’d decided to remove the word SNAPSHOT from the id in defproject.

lein deploy assumes that SNAPSHOTs default to being deployed in classic (the “free-for-all” part of Clojars) whereas non-SNAPSHOTS are intended to be deployed in the new “releases” repository, which is slightly more formalized arrangement, requiring author signing.

– I have gpg on my machine, and I did set up signing for my email address a couple of years ago. This was nothing to do with the previous library I put on Clojars. It was when I was experimenting with encrypted email. (A practice that I’ve embarrassingly let slip since then, but should really go back to.) So that’s the pass-phrase that was being demanded, and that I’ve managed to forget (from 2012, not end of 2014). Not impressive, but not quite as bad as creating one four months ago and then totally forgetting about it.

That still leaves me with some problems when I eventually will want to put my libraries into “releases”) but at least I can still use Clojars. The library will have to continue as a SNAPSHOT though.

Bloody hell! I just wrote a blog post and WordPress lost it.

Grrrr …

The short resume was :

– yes, I’m late (Feb) continuing my “Welcome to 2015” blog posts.

– last year I got the functional programming bug. Haskell is pretty damned good, but I’ve fallen for Clojure because a) dynamic types, b) Lisp syntax(lessness), c) Paredit.

– last year I did more Python, but not much OWL. This year, OWL is calling again. And as well as making me want to rethink Mind Traffic Control in light of it, is also seeming to demand some kind of pivot on GeekWeaver.

I’ll be coding and blogging more on this ongoing development in coming weeks / months.

I’ve also been playing a bit with remoteStorage, but nothing to show yet.

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

Wow! Now this is weird!

I honestly don’t know what to make of Clojure’s ad-hoc hierarchies. I have, I confess, been missing a little bit of the polymorphism I’m used to with classic OO class-hierarchies.

This looks like it’s the answer to that. But hmmmm …. if I start down this path am I going to find myself reinventing standard OO capacities with a weird syntax? Does adopting these things mean I’m falling back from my FP sophistication to “class-based” programming? Is it the equivalent of abusing do to make my Lisp more imperative?