From memory Prolog stands for 'Programming with Logic' and it was popular with the Japanese AI community back in the 1980s, when they were taking over the world. It is based around 'first order predicate calculus', and if I had my notes I'd tell you what it meant. One of the main things to take from it though, is that Prolog is a formal language based on mathematics, and thus (in some sense) provable. Another formal language, that you may have heard of? SQL is based on set theory and in an ideal world is provable -E & OE, YMMV, not all implementations are equal, shares may go down as well as up!
First black mark, likes(X, Y) isn't the same as likes (X, Y) -the first is correct- in GNU Prolog.
Exercise : Create a knowledge base representing musicians and instruments. Also represent musicians and their genre of music.
I did this using tuples :
musician('Richard Thompson','Guitar','Folk') .Which allows me to write queries like :
musician('Kathryn Tickell','Uillean Pipes','Folk') .
musician('John Lee Hooker','Guitar','Blues') .
| ?- musician(Who,'Guitar',Genre).
Genre = 'Folk'
Who = 'Richard Thompson' ? a
Genre = 'Blues'
Who = 'John Lee Hooker'
yes
Very pretty, but at the end of the day it's just a database query.
No comments:
Post a Comment