I second the recommendation in Sir Whinesalot's post (which I haven't fully read yet) to look at miniKanren and microKanren. I found it extremely educational to port microKanren to OCaml a few years ago, and I think the result is somewhat more comprehensible than the original Scheme, though you'll still probably have to read the paper to understand it: http://canonical.org/~kragen/sw/dev3/mukanren.ml
The most astonishing result of miniKanren is a Scheme interpreter that you can run forwards, backwards, or both. http://webyrd.net/quines/quines.pdf demonstrates using it to generate a program whose output when run is itself ("miniKanren, Live and Untagged
Quine Generation via Relational Interpreters
(Programming Pearl)", Byrd, Holk, and Friedman).
Unlike the post, I don't think Datalog is the place to look for deep insights about logic programming. Instead, it's the place to look for deep insights about databases.
sirwhinesalot · 55m ago
Or more accurately, a super simple Datalog implementation.
The most astonishing result of miniKanren is a Scheme interpreter that you can run forwards, backwards, or both. http://webyrd.net/quines/quines.pdf demonstrates using it to generate a program whose output when run is itself ("miniKanren, Live and Untagged Quine Generation via Relational Interpreters (Programming Pearl)", Byrd, Holk, and Friedman).
Unlike the post, I don't think Datalog is the place to look for deep insights about logic programming. Instead, it's the place to look for deep insights about databases.