Josh Munn's Website

Python

Rewriting a recursive Python function as an abstract machine

Silhouette of a person standing by a tree on a hill

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/.

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.

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 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}))'))