## Parrotlog - Unification (again)

In the I went with the simple solution to the problem of unification. Variables point to other variables, and in the end a variable either points to a term, or nothing. What happens when you unify X with Y, Y with Z, and Z with X should probably not be considered just yet, and will probably have to be fixed at some point. But that should be reasonably simple. Finding cycles in a graph is after all a well-known problem.

This means that the core infrastructure I need should now be in place: unification, backtracking and cuts (a post on those last two is coming up). Now it's time to start looking into writing the grammar, and figuring out how to represent rules and the fact database.

The usual approach to remove cicles is to not make then in the first place unifying not the heads of the chains but their last elements.

For instance, in your example, after unifying X=Y and Y=Z you have the chains X->Y->Z, Y->Z, Z, then unifying X=Z reduces to Y=Z that reduces to Z=Z

Yeah, that would make a lot of sense. Thanks!