Programming
Working with wagtail-factories block factories
Wagtail’s killer feature is the stream field system for flexible content. In this tutorial we will learn how to create and use factory classes that enable us to generate content for stream field blocks, just like we would with factories for Django models.
Getting started with wagtail-factories
In this tutorial, we will learn how to use the wagtail-factories library to create factory boy factories for a Wagtail project. These factories facilitate the easy creation of model instances, which is particularly useful for tests.
We’ll learn about factories for Wagtail’s models - factories for stream field blocks will be covered in another document.
Rewriting a recursive Python function as an abstract machine

The miniKanren paper (Will Byrd’s thesis) describes walk*, which is used to deeply walk some term with regards to a substitution. That means that if a given term is not atomic (e.g. it’s a list), it will walk all of its sub-terms, recursively. Here’s a naive translation to Python:
2023 Talk: Infinite Pizza
In November 2023 I gave a talk at a Torchbox internal tech team conference day. The talk was titled “Infinite Pizza”, and was an introduction to logic programming, using Python.
The slides can be viewed at https://microkanren-talk.joshuamunn.com/.
TIL: Emacs Repeat Maps
I learned about Emacs’ repeat-mode from the dape docs. It’s explained effectively in this blog post by Karthinks. It turns out repeat-mode has recently been added to Emacs core — I’m using 30.0.91, which has a bunch of my favourite recent packages included. It’s a very convenient package. I’m using it with dape, smerge, and flymake, and it really helps cut down on repeated modifiers.
Why I'm Rewriting Microkanren
I’m rewriting my Python microkanren implementation. I’ve always wanted to add tabling, have tried a few times, but stopped due to lack of time, and subtle errors. I’m taking a few steps to simplify the core implementation, and get tabling done.
Emacs Lisp in Haskell
Since first migrating from OSX to Linux, I have been a user of the dwm tiling window manager. It is great software, my thanks to the authors. Lately, however, I’ve had an itch to change things up. I’ve been spending some time learning Haskell, so Xmonad is an obvious choice.
Microkanren, Cons and Python
I’ve been implementing µKanren in Python. One challenge so far has been creating a sequence abstraction with semantics similar to Lisp lists. This is important as it’s necessary to be able to decompose sequences into parts for unification, such that:
A Minikanren Quine
Here’s a miniKanren quine that runs on the miniKanren implementation from The Reasoned Schemer:
((lambda (_)
(run* x
(conde
((≡ x _))
((≡ x (list 'quote _))))))
'(lambda (_)
(run* x
(conde
((≡ x _))
((≡ x (list 'quote _)))))))
A Python Quine
Here’s a Python 3 quine I wrote:
(q:='(q:={q!r},print(f{q!r}))',print(f'(q:={q!r},print(f{q!r}))'))