|
Prolog is excellent for queries on
relational data (as in the Mathematical sense of a "relation"), e.g.
orbits(mercury, sun). {facts}
orbits(venus, sun).
orbits(earth, sun).
orbits(mars, sun).
orbits(moon, earth).
orbits(phobos, mars).
orbits(deimos, mars).
planet(P) <= orbits(P, sun). {rules}
satellite(S) <= orbits(S, P) and planet(P).
? satellite(S). {query}
|
Apparently this was used in
question 24 'Evolution of Programming Languages', in
Section III of 'Software Design and Development',
2010 Higher School Certificate Examination, NSW.
|
|