April 28, 2014

core.logic-o

While exploring Clojure's core.logic a bit, I stumbled on a set of just amazing videos. Clojure's core.logic is based on an implementation of miniKanren. If you don't know what that is, don't worry, I did not either. But it is really simple: MiniKanren is a DSL for logic programming based on three logical operators (==, fresh and conde) and one inference operator (run). If you take that you can do some really cool stuff. What exactly ? Well, that's where these videos come in:
I'm purposefully not saying what exactly is being shown. Just pick any one and you'll probably catch the bug. (Or maybe that's just me. :-))

April 10, 2014

Minimalist Parser Combinators

Now over at my github account: a minimalist implementation of parser combinators. Parser combinators provide an easy yet powerful way of implementing parsers, without the need of understanding compiler theory or formal grammars (though it can't hurt, of course). They also form the basis for my Koopa project, precisely because you can easily extend this technique to fit your needs.

This minimalist implementation may be slightly too minimalist, though. It only tells you whether something can be parsed or not. There is no way to extract anything useful while doing so —yet.

April 01, 2014

Minimalist Entity/Component System

I just uploaded a new addition to the minimalist code series. This time it's a minimalist version of an Entity/Component System. An ECS is a bit of a specialized architecture for modeling complex systems of dynamic objects. The origins for such systems come from the gaming world, but it has made its way into very different kinds of applications (the LightTable IDE is a great example here). If you're interested, the Entity Systems Wiki is a great resource for going deeper.

Javascript makes it really easy to set up such a system. In fact, the example I added is way more complex and took much longer to write than the actual engine itself. I was debating with myself whether or not to go for a more fluent API than what I provided now, but I was somewhat worried that I would be explaining the fluent part more than the actual ECS principles. If anyone is still interested in a more fluent version, though, let me know and I'll spend some time on that.