Skip to content
← The Lab
Proof of concept · Open source Reproduced

orhof, operations research as higher-order functions

A dependency-free Clojure library that reconstructs a large body of operations-research algorithms as compositions of a small set of higher-order-function patterns.

· 12 August 2026

What it proves

That a large body of operations-research algorithms, across optimisation, sequential decision-making and validation, are not separate inventions but compositions of a small, shared set of higher-order-function patterns, expressed in Clojure with nothing underneath but the standard library.

Built with

Clojure 1.12 · Zero dependencies

orhof is the executable companion to the book Applied Higher Order Functions. Its argument is structural: much of operations research, taught as a catalogue of distinct techniques, is better read as a small vocabulary of higher-order functions composed in different orders. The library exists to make that argument runnable rather than rhetorical.

What it is

A single Clojure 1.12 library with zero third-party dependencies: the code stands on the standard library alone, so nothing about its behaviour is delegated to an unread solver. It publishes 251 public functions across 30 namespaces, backed by 187 deterministic tests so that every claimed identity can be re-run and checked rather than taken on trust.

The functions span three domains that are usually kept apart:

  • optimisation, descent methods, line searches and the combinatorial workhorses;
  • Markov decision processes and reinforcement learning, value and policy iteration, and the learning rules that approximate them;
  • temporal-logic validation, operators that turn a specification into a scoring function over traces.

What it demonstrates

The point is not that these three areas can each be written in Clojure. It is that they draw on the same higher-order patterns. A generic descent skeleton, given different step and update arguments, becomes several named optimisation methods. A single transformer over a Markov decision process yields the Bellman step that value iteration repeats. Temporal operators read as folds over a trace that return a continuous robustness score. Seen this way, the catalogue collapses: fewer primitives, more compositions.

Because the library is small, dependency-free and fully tested, that collapse is inspectable. A reader can open a namespace, follow a named algorithm back to the primitive it composes, and run the test that pins the two together.

Why it is a proof of concept

orhof reproduces established algorithms. It does not claim new ones. The implementations are written to be read, to expose the shared structure, and are deliberately not tuned to compete with specialised industrial solvers on large instances. The evidence status is therefore reproduced: the identities hold and are independently re-runnable, and the contribution is the demonstrated structure rather than raw speed. That boundary is the honest one, and it is the same boundary the book draws around itself.

Method disclosure

The method is published.

Open source, zero dependencies beyond Clojure itself.

We publish selectively and say which. Open-source, academic and pro bono work is published in full. Where the mechanism is the commercial asset we publish the result, the evidence grade and the boundary, and state that the mechanism is withheld, and never write around the gap.

Limitations & novelty boundary

orhof reimplements known algorithms to demonstrate a structural thesis, not to win benchmarks. The reference implementations are clear rather than tuned, and are not expected to beat specialised industrial solvers on large instances. It is evidence for a claim about structure, not a replacement for a production solver.

Start with the decision

Want this applied to your decision?

Our research becomes a system when it meets a constrained decision with data behind it. If that sounds like yours, bring it to us.