Hacker News new | ask | show | jobs
by exDM69 4977 days ago
Not really a tutorial and not really Prolog, but here's an interpreter for a logic programming language written in Haskell: https://github.com/rikusalminen/slolog

I wrote it as a project work in an Artificial Intelligence class. It very closely resembles the logic programming language implemented in "Structure and Interpretation of Computer Programs".

I'm sorry there isn't any documentation for it.

Here's a little example of what it looks like, from examples/royalfamily.slo:

(siblings ?x ?y) <- (parent ?x ?parent) & (parent ?y ?parent)

(grandparent ?x ?y) <- (parent ?x ?z) & (parent ?z ?y)

(cousins ?x ?y) <- (grandparent ?x ?gp) & (grandparent ?y ?gp) & !(siblings ?x ?y)