Dogalog

An educational toy - learn Prolog while making beats! Live on the Web! (source)

I stumbled on Euclidean Rhythms a little while ago, an arithmetic pattern for spacing beats in a bar, found across all kinds of music. It's kinda like a constraint problem.

More recently I had another look at livecoding music. I seem to have something of a mental block on it, I still haven't really had a go. Although intrigued I did write a MCP server for Sonic Pi.

Anyway, the other night I couldn't sleep. Those ideas clunked together in my head, making me think about livecoding in Prolog. I spent most of the night roughing something out with Codex. I still haven't looked if there's already a Prolog livecoding engine - I'm probably reinventing the wheel. Well, this will be training wheels.

Because the following day I realised I couldn't remember how Prolog works. So the challenge became to make something that would get me livecoding and teach me Prolog. Dogalog is the result of a good few hours with Claude on it. It's reasonably well structured, should be ok to extend/maintain. Probably a mistake implementing the Prolog engine from scratch. But without the fancier constructs and optimisations, it isn't that complicated: term definitions, parser, unifier. The in-place editing went a lot more smoothly than I could have imagined.

It would benefit from a few more eyeballs. I wonder if anyone still teaches Prolog? I guess I'll post to Reddit, r/livecoding and r/prolog.