Monday, January 7, 2013

Prolog - better than AmateurLog

Today was my first day playing with prolog.  Prolog is a very different language than anything I'm used to.  You don't tell it how to do something like with most programming languages. Instead you tell it what you want and the facts of the environment it has to work in and prolog does all the "how" for you.



The book compares it to a baker, versus a recipe.  With a recipe there is a specific set of instructions that if followed exactly you should end up with the same result each time.

Prolog is like a baker - you tell it "I want a chocolate cake that is chewy, has vanilla icing between 3 layers and on top, and chocolate shavings on top as well.  Here are the ingredients I have." Based on your ingredients it will make the cake (or it will just say "no" if you don't have everything it needs -- that made me laugh when the computer just said "no" when I made a mistake)

So play along:

brew install gnu-prolog

then surf over to my github repo and see what you think

1 comment:

  1. You're bringing up some painful memories of mine from university years :)

    https://github.com/mondalaci/misc/blob/master/prolog-parser.pl

    ReplyDelete