Best resource to learn prolog

Hey. I’ve been trying to get deeper into prolog and general logic programming, but I find it quite hard to learn everything. I know of The Power of Prolog but the verry first program they show Facets of Prolog doesn’t work with SWI-Prolog. It sounds like it uses outdated or wrong operators? SWI-Prolog doesn’t support #= or #>, so I’m not quite sure if it’s dated or not.

I’ve also tried the same piece of code on scryer prolog and it still errors on the #> operator.

1 Like

Hi,

The #-prefixed operators come from a library that you need to load, as noted in the “Facets” page you’ve linked to.

In SWI-Prolog, you get them from library(clpfd).

HTH

Thank you.

I didn’t know that one (The power of Prolog), it seems interesting. Another resource you should take a look at is “Learn Prolog Now!”. It focuses mainly on list processing, definite clause grammars and language processing. A more recent one I found is “Logic programming with Prolog” by Max Bramer. Maybe you can find the pdf version somewhere, if you search the internet or emule.

https://cs.union.edu/~striegnk/learn-prolog-now/lpnpage.php?pageid=online