Posts

Showing posts from November 4, 2009

Real World Examples

I 'm a software engineer by trade and in my studies I learned about a programming language called Prolog. Unlike most programming languages, which are written as a sequence of events, with Prolog you define a goal and let the computer figure out how to accomplish it. It’s a fascinating approach to programming, but most of the examples looks something like this: dog(spot). dog(rex). cat(tom). cat(sheba). animal(X) :- dog(X). animal(X) :- cat(X). ?- animal(Y). spot ; rex ; tom ; sheba ; ?- I won't ask you to try to make sense of that, unless you really want to. Essentially, given a list of named dogs and cats, and a definition that specifies that dogs and cats are animals, the computer will return the names of all animals. I’m sure I find that more impressive than you do, but even I have to wonder what is so great about being able to get the complete list of animals in this way. It demonstrates the language, but it doesn’t really tell us...