Clojure conditional feature reader

I’ve been experimenting with tagged literals and data-readers to create what I’m calling a “conditional feature reader”. The basic element is the condf tag, which works sort of like cond but the tests are “feature requirements”. A feature requirement can be something like clj1.5 (meaning Clojure 1.5) or java1.6+ (meaning JDK 1.6 or greater). For example:

(println #feature/condf [(and jdk1.6+ clj1.5.*) "Ready for reducers" else "No reducers for you."])

I’ve only implemented it for regular Clojure 1.4 and 1.5 (on the JVM), but I’m hoping it might prove useful for other variants such as ClojureScript.

For more details, see:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s