Question

I have a basic understanding of how recursion works in Prolog. I am finding it difficult to think in declarative paradigm. Could you suggest some learning resources(with solved examples) for writing recursive predicates?

Was it helpful?

Solution

My answer here to the question "Prolog programming - path way to a solution" lists several [book] resources.

When I was learning Prolog, I found Leon Sterling and Ehud Shapiro's The Art of Prolog far more enlightening than other books on the subject

Art of Prolog cover

Richard O'Keefe's The Craft of Prolog looks good, too, but I can't say I've ever looked at it:

Craft of Prolog cover

OTHER TIPS

I think that Prolog shows its best in 'basic' Natural Language Processing. Indeed, that was its first and foremost battlefield, long time ago.

('basic' because NLP has much complexity that's not related at all to the choice of any implementation...)

But NLP show two fields where recursion it's important for implementation (it's inherent in the problem):

  • grammars are inherently recursive - recursion in the 'data'
  • parsing: need a language to analyze languages - metaprogramming as a basic tool.

Parsing can be seen as the simplest area where both problems need to be solved.

As a consequence, the book I do prefer it's Prolog and Natural-Language Analysis, by Pereira-Shieber.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top