Introduction To Turbo Prolog By Carl Townsend Pdf -

Introduction To Turbo Prolog By Carl Townsend Pdf -

Recursion is the loop of Prolog. Where other books use mathematical examples (factorials, Fibonacci), Townsend uses genealogical trees. His famous "Ancestor" example unfolds over several pages:

No—and yes.

For those specifically running the Turbo Prolog 2.0 compiler under DOSBox, the book is 100% accurate and invaluable. INTRODUCTION TO TURBO PROLOG BY CARL TOWNSEND PDF

To give you a taste of Townsend's style, consider his explanation of reversing a list. Modern textbooks throw math at you. Townsend does this:

"Imagine you have a deck of cards. To reverse them, you take the top card, put it on the table, take the next card, put it on top of the first, and so on. In Prolog, we use an auxiliary predicate to hold the cards we've already moved." Recursion is the loop of Prolog

He then provides:

predicates
  reverse(list, list)
  reverse_aux(list, list, list)

clauses reverse(Old, New) :- reverse_aux(Old, [], New). For those specifically running the Turbo Prolog 2

reverse_aux([], New, New). reverse_aux([Head|Tail], Temp, New) :- reverse_aux(Tail, [Head|Temp], New).

He then walks through the stack trace, showing Temp accumulating reversed elements. This concrete, physical visualization is why the "Carl Townsend PDF" remains a gold standard.

The book covers Turbo Prolog’s unique features that were absent in standard Edinburgh Prolog: