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?
-
1This is a nice variety of problems that use recursion: http://www.ic.unicamp.br/~meidanis/courses/mc336/2009s2/prolog/problemas/ – lurker Apr 17 '14 at 21:49
-
2Click on the Prolog tag below your question. :) – Daniel Lyons Apr 17 '14 at 22:32
2 Answers
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
Richard O'Keefe's The Craft of Prolog looks good, too, but I can't say I've ever looked at it:

- 1
- 1

- 71,308
- 16
- 93
- 135
-
1_Craft_ is pretty advanced. I got a lot of mileage out of _Programming in Prolog_. IMO, Prolog books tend to be great; I haven't read a real stinker yet. – Daniel Lyons Apr 17 '14 at 23:56
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.

- 59,646
- 5
- 47
- 90