March 27th, 2002, 04:37 AM
Short & Simple Prolog Tutorial
i've been here almost 3 months now without really posting anything too useful, so i thought i'd start with a simple toutorial of my latest interest: prolog.
What is Prolog
prolog is not like any language you've probably used before. prolog is short for PROgramming in LOGic. programs consist of datebase of rules and facts, and are run by asking the compiler questions that can be proven by the database.
Who Uses Prolog?
you aren't going to find many fans of prolog among systems programers or anyone writing large scale applications. it is mostly used in the artifical intelligence community for natural language interfaces and automated reasoning systems.
to start off a program in prolog you need to compile a database of facts. most are pretty straightforward:
defines sally as a female.
defines chuck as sally's parent. once you have a complete database, you can start defining rules. for example:
father(X,Y):- male(X), parent(X,Y).
defines the father of Y as the male parent of Y. therefore if my database contains:
father(X,Y):- male(x), parent(X,Y).
asking the compiler
more specifically, asking the compiler
Word of Warning
prolog compliers are famous for having just one response to dealing with questions they can't answer or databases with syntax errors: "No." if you don't like having your computer telling you "No." then maybe prolog is not for you
anyway prolog is fun once you get the hang of it. if anyone has any questions, comments, please feel free to message me, i'm always looking for (constructive) criticsism!
ps - i'm playing with some small interactive programs, little ones that can carry on very simple conversations....just few responses to simple questions ("how are you today?" "great! thanks for asking") and with time could grow to have simple personalities if anyones interested or would like to contribute i'm more then willing to share the spotlight. thanx again!
U suk at teh intuhnet1!!1!1one
March 27th, 2002, 06:50 AM
Wow...that brings back memories...haven't heard anything about Prolog in years