Clojure.test and Leinigen: How to run just a single test from command line

What you are looking for is probably: lein test :only my.namespace/my-test Note that: lein help test outputs: “A default :only test-selector is available to run select tests. For example, `lein test :only leiningen.test.test/test-default-selector` only runs the specified test. A default :all test-selector is available to run all tests.”

How do I get a Unix Timestamp in Clojure?

Pretty much all JVM-based timestamp mechanisms measure time as milliseconds since the epoch – so no, nothing standard** that will give seconds since epoch. Your function can be slightly simplified as: (quot (System/currentTimeMillis) 1000) ** Joda might have something like this, but pulling in a third-party library for this seems like overkill.

Clojure apply vs map

I have a simple explanation which this post is lacking. Let’s imagine an abstract function F and a vector. So, (apply F [1 2 3 4 5]) translates to (F 1 2 3 4 5) which means that F has to be at best case variadic. While (map F [1 2 3 4 5]) translates … Read more

Are functional programming languages suitable for graphics programming?

You can use functional languages to do graphics/game programming just as in any other language. It’s only a simple game, but I wrote Ironclad: Steam Legions in Clojure as an exercise in functional programming for game development. Here are some lessons I learnt / general observations on using Clojure for game programming: You need to … Read more

Clojure: Convert hash-maps key strings to keywords?

You can also use the clojure.walk library to achieve the desired result with the function keywordize-keys (use ‘clojure.walk) (keywordize-keys {“name” “Tylenol”, “how” “instructions”}) ;=> {:name “Tylenol”, :how “instructions”} This will walk the map recursively as well so it will “keywordize” keys in nested map too http://clojuredocs.org/clojure_core/clojure.walk/keywordize-keys