What's the best logic lang for noobs? (I know data...
# of-logic-programming
c
What's the best logic lang for noobs? (I know datalog is teh hotness, just want to invest hours in the right place) Is there a good primer you'd recommend?
a
I would tentatively suggest the [Mini]Kanren implementation for your favorite programming language. I got started with it relatively quickly, even though I didn't find a super great tutorial for doing non-trivial things with it. Logpy is short enough you can just read it and get an idea of what's going on. I would love to hear is there's some sort of go-to open source Datalog.
๐Ÿบ 2
๐Ÿ‘ 2
g
I second the miniKanren comment
g
i would like to get into using an actual logic programming language but it seems like they lack solid intros in general. @Andrew F if you have any time/interest iโ€™d be super into running a (possibly recorded) virtual meetup on the topic with someone knowledgeable walking someone through getting started
๐Ÿ‘ 2
n
Best logic language to gain inspiration from, or to build a toy project with? Obviously it would be ideal if you could do both at the same time. Datalog is a very simple logic language, which makes it easy to understand, but accordingly it's so limited that you can't really build much with it. In an attempt to address this, people have gone in two directions: extend Datalog with new features, or embed Datalog into a traditional programming language. I think the former is far more exciting. You can play with Datalog using any Prolog engine, because Datalog is technically just a subset of Prolog. Unfortunately for developing non-trivial Datalog programs you really need an extension of Datalog, and I don't know any ready-made extensions that I can recommend. I certainly wouldn't recommend Prolog!
@Garth Goldwater A logic programming meetup/learning group would be cool ๐Ÿ™‚
Actually here's a standalone Datalog evaluator and GUI that you can run as a JAR: http://abcdatalog.seas.harvard.edu/
๐Ÿ‘ 2
j
In practice, I prefer logic programming as a library within a functional langauge, but it can be quite helpful to start off in that world within the context of a language that forces you to do everything the LP way. If you want to try that, I recommend SWI-Prolog, which is well maintained and offers loads of tutorials.
๐Ÿ‘ 4
e
I was planning to work on http://aima.cs.berkeley.edu/ at some point. Section 3 Knowledge, reasoning, and planning covers first order logic and has algorithm implementations in java and python (and other languages) https://github.com/aimacode
๐Ÿ‘€ 1
has anybody here worked through that book? It is massive ๐Ÿ˜ฌ
but the prose looks very approachable
c
I learned quite a bit about logic programming from The Little Schemer, which was a guided trial and error based lessons which incrementally built up a miniKaren implementation. I learned a lot of the fundamental vocab in a short amount of time with that
๐Ÿ‘ 1
n
@Cole I think the book you're referring to is "The Reasoned Schemer", from the same author!
c
@Nick Smith hmm sounds very likely that I got the title wrong! โ€“ yup, I meant "The Reasoned Schemer"
e
I hate The Reasoned Schemer to be honest. Is one of those books that makes you feel dumb (together with countless other math books where every other proof is either "obvious" or "the reader can easily see" ...) ๐Ÿ’ข
๐Ÿ˜… 1
But still it seems like one of the best resources to learn how to implement a small datalog engine, so I still have it in the backburner to revisit it.
Last time I realized the author actually has a couple of other resources that should be useful to work through the book:
few playlists of at least two previous "uncourses" (? will find out when I get to watch them I guess haha)
The problem with the book IMHO is that is sets the expectation you will be able to read it front to back. On a second read I think it is probably better to start with reading a complete implementation, running some examples, etc. then picking up the book
๐Ÿ‘Œ 1
c
I did find it more entertaining as a lesson book than something helpful for me now-a-days
b
@Chris G There is the book โ€œThinking as Computation: A First Courseโ€. It gives an excellent introduction to Prolog along the way. I started going through it recently but got sidetracked with other things, although I was really enjoying the book.
โญ 1
c
thank you!