Skip to content →

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…

C++ callbacks into Java via JNI made easy(ier)

I just finished writing a Java wrapper for a complex C++ library, and had a fair bit of trouble finding solutions to (or even basic documentation pertaining to) some of the problems that came up. Things seem pretty easy if…

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…

The hardest eight-puzzle instances take 31 moves to solve

I’m sure this information is available elsewhere, but I couldn’t find it with a quick google search — the two hardest 8-puzzle instances are: 8 6 7 2 5 4 3 . 1   6 4 7 8 5 .…