Skip to content →

Category archive for: Clojure

Reversing the order of Clojure’s exception chains in SLIME

When debugging a complex Clojure project with SLIME, I would often find myself chasing chains of exceptions as much as 20 levels deep to get to the true cause of a problem. I finally tired of the “11111111111”-look-“0000000000” exercise, especially…

Dynamic type hints in Clojure macros

Sometimes, one wants to write a Clojure macro to assist in Java interoperability, where the object types are determined by the arguments to the macro. In this situation, the normal strategy of using a #^class type hint doesn’t work, since…

Quick tip for debugging & profiling Clojure code with multimethods

Debugging and profiling Clojure code with multimethods can be a pain, since methods show up as anonymous functions in stack traces and profile results. When you’re debugging you at least get a line number, but if you’ve loaded your code…

Time/Memory Limiting/Instrumenting Clojure code

I wrote some simple utilities for measuring time and memory usage of Clojure code, and running Clojure code within preset time and memory limits. The methods used for handling memory are a bit hacky, but they seem to work OK…

Efficiency of Clojure’s built-in set operations

If you’re using Clojure’s built-in set operations, clojure.set/union/intersection/difference, you should be aware that their speed currently depends (sometimes dramatically) on the order of the arguments given. And, since clojure.set/difference is not commutative, it is simply needlessly slow if the second…

Computing java.util.List hashCode()s back-to-front

For some applications, it could be desirable to compute java.util.List hashCode()s backwards, recursively from back to front, rather than front-to-back as defined in the API [1]. For instance, in Clojure this would enable computing the hash values for all of…