Chapter 7. Programming with Logic
We will now take a step back from the realm of functional programming and explore a completely different paradigm—logic programming. Logic programming has its own unique way of solving computational problems. Of course, logic programming isn't the only way to solve a problem, but it's interesting to see what kind of problems can be easily solved with it.
Although logic programming and functional programming are two completely different paradigms, they do have a few commonalities. Firstly, both of these paradigms are forms of declarative programming. Studies and papers have also shown that it is possible to implement the semantics of logic programming within a functional programming language. Hence, logic programming operates at a much higher degree of abstraction than functional programming. Logic programming is more suited for problems in which we have a set of rules, and we intend to find all the possible values that conform...