I’ve copied just the relevant portions of John McCarthys lesson here:
Then there is an over view of applying his ideas in minikanren here:
Finally, you can get the minikanren source code with the “map coloring” example program (and others) here: