[HN Gopher] Implementing Logic Programming
___________________________________________________________________
Implementing Logic Programming
Author : sirwhinesalot
Score : 20 points
Date : 2025-06-13 21:32 UTC (1 hours ago)
(HTM) web link (btmc.substack.com)
(TXT) w3m dump (btmc.substack.com)
| sirwhinesalot wrote:
| Or more accurately, a super simple Datalog implementation.
| kragen wrote:
| 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.
| xlii wrote:
| Lately I've been dabbling with different Prolog implementations
| and Constraint Handling Rules which led me to CLIPS [0] (in
| Public Domain, but developed at NASA - sounds neat doesn't it?)
|
| It's not very easy to get into, but it's very fast on rule
| resolution and being pure C is easy to integrate. I'm trying to
| get smart code parsing using logic language and this seems
| promising. I'm also a Lisp nerd so that works for me :)
|
| [0]: https://www.clipsrules.net/
| fracus wrote:
| I think it would be really impactful to start with a problem and
| describe how logic programming solves that problem better than
| the other paradigms.
___________________________________________________________________
(page generated 2025-06-13 23:00 UTC)