Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How PROLOG Works!

3 views
Skip to first unread message

Graham Cooper

unread,
Nov 10, 2012, 8:37:44 PM11/10/12
to
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
While the query is not empty do
select an atom from the query
select a fact or rule with which the atom unifies
If there is none
then return {failed}
Else
If a fact was selected
Then
remove the atom from the query
Else If a rule was selected
replace the atom in the query by the
body of the selected rule
return {succeeded}


e.g.

============================

HEAD old(tom).
RULE oldman(X) <- man(X), old(X).

...... ^ HEAD ...........^ BODY

=============================

QUERY ?- oldman(tom).

replace the atom in the query by the
body of the selected rule

GOALS = man(tom), old(tom)

Herc
0 new messages