Projectional Editing in Two Steps

1. Normal Form

I favour a normal form consisting of triples.


2. Rules

You want to perform exhaustive search over all of the triples.

A rule is just a group of related searches.

Such searching can be done manually, using loops within loops.

Or, one could use a tool — a search engine — to do the searching. One such search engine is PROLOG. Another engine might be miniKanren.

PROLOG uses backtracking to perform exhaustive search.

PROLOG uses something called logic variables to hold the results of successful matches.

There might be more than one match that succeeds in satisfying all of the search constraints. In such cases, PROLOG re-binds the values of the logic variables and presents you, the programmer, with a set of consistent matches (as one set of bound logic variables).

MiniKanren, on the other hand, does not use the above method and keeps a running list of all possible matches, then presents you, the programmer, with a list of all matches that consistently solve the set of given match constraints.


PROLOG uses an algorithm, called unification, to re-bind logic variables.

One set of bindings describes one solution to all of the match constraints.

In essence, PROLOG clears its logic variables before calculating another solution. In essence, PROLOG memorizes previous solutions and does not present already-seen solutions again.

[Note, that this does not mean that duplicate solutions cannot be displayed — PROLOG remembers the route that it used to find a solution, if it finds a different route which results in the same set of bindings, PROLOG will be happy to show you that solution as a possibility (much to the chagrin of PROLOG newbies).]


I would suggest: