Prolog Programming Questions And Answers

What are the names of the algorithms and concepts used in Prolog? Logic programming Depth-first, backtracking search Unification See Sterling & Shapiro, The Art of Prolog (MIT Press) for the theory behind Prolog. Probably it builds some kind of tree structure or directed object graph, and then upon queries it traveres that graph with a sophisticated algorithm. A Depth First Search maybe. It ...

Prolog Programming Questions And Answers 1

Prolog is a bit unique as a programming language: it is declarative, has builtin backtracking, predicates work multidirectional, and the mix of all these features tends to be hard to understand.

What does + mean in Prolog? Ask Question Asked 16 years, 5 months ago Modified 8 years ago

Prolog Programming Questions And Answers 3

The = "operator" in Prolog is actually a predicate (with infix notation) =/2 that succeeds when the two terms are unified. Thus X = 2 or 2 = X amount to the same thing, a goal to unify X with 2.

Prolog Programming Questions And Answers 4

There are some special operators in Prolog, one of them is is, however, recently I came across the =:= operator and have no idea how it works. Can someone explain what this operator does, and also ...

Prolog Programming Questions And Answers 5

In Prolog, the "not" is an example of "negation as failure", but it is felt that + will make it clearer to the programmer just what precisely is being asserted in any given rule. So you CAN use "not" (most PL implementations keep it for backwards-compatibility) but to be an idiomatic modern PL programmer, you probably should prefer to use +.

Is there a way to do an if in prolog, e.g. if a variable is 0, then to do some actions (write text to the terminal). An else isn't even needed, but I can't find any documentation of if.