Prolog/Reading and Writing code

From Wikibooks, open books for an open world
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This section gives guidelines and tips on reading and writing prolog code, and how to think about prolog code in general.

Examples

[edit | edit source]

fac(0,1).

fac(A,B) :- A > 0, C is A-1, fac(C,D), B is A*D.

Exercises

[edit | edit source]

previous: Cuts and Negation next: Difference Lists