Coding 2024-02-24

Tags:
By Max Woerner Chase

Well, I didn't get anything done on the stuff I was working on just two days ago, so here's what happened instead:

Every once in a while, I read about a programming concept, and just go through implementing it without any clear idea of what I'm going to do with it. This time, it was getting reminded of the existence of μKanren, and trying to put together some Python implementations.

The one that probably works, (though I haven't actually tested all of the primitives, so there could be some really nasty surprises in there) is based around using pyrsistent maps for states, an attrs class that compares by identity for variables, and using iterators for streams. That description basically locks down most of the implementation; I'll also note that I favored callable classes over closures. What remains is the definition of unification, which, well...

The definition of unify and the terms of the language are orthogonal to the presentation of μKanren: both could be changed with limited consequence for the rest of the system.

So, naturally, I figured out how to make that all extremely configurable. Basically, there are some new operators, which register new implementations of unification for the purposes of the goal that they wrap.

I am still not sure what to do with this, if anything, so I'm going to try to switch gears soon. Anyway, I'm starting to feel a little stiff, so I'm going to wrap up now.

Good night.