News for hackers. Stuff that matters.
Re:The Prolog Story by jm4 on Thursday May 20, 2010 @08:14AM (#1363808)
The book Seven Languages in Seven Weeks has a chapter on Prolog. There is an interview in there with a guy who was doing research on dolphins and used Prolog to build a dolphin simulator. As they learned new things about the dolphins they would add "facts" to the simulator and used it to try to discover new things.

They could also use it for "debugging" training problems. He had a story about a dolphin who would apparently ignore a specific instruction and just sink down into the tank. They were able to use the simulator to figure out that the problem was not with the dolphin, but with both the instruction given and the surrounding environment at the time they would give the instruction. It turned out the dolphin was actually "following the rules", but the trainers failed to see it.

He also talks about using Prolog to build a scheduling system. Access to trained dolphins is a precious resource and it was important to find the optimal schedule for research. With a handful of facts and rules, Prolog was able to discover it for them. Pretty neat stuff.

Re:The Prolog Story by rick_2047 on Thursday May 20, 2010 @09:11AM (#1363910)
do you have any links or resources for this? I would really like to read about this more.
Re:The Prolog Story by silentbicycle on Thursday May 20, 2010 @09:26AM (#1363942)
If you want to learn about Prolog, the best book IMHO is _The Art of Prolog_ by Sterling and Shapiro. The newer edition is out of print and expensive (but worth it!), the previous edition is more like $6 and will give you a good taste. _Programming in Prolog_ by Clocksin & Mellish is a pretty straightforward overview of the language, but TAoP really gets at Prolog's real potential.

I also liked _Clause and Effect_, which is somewhat like a "Little Schemer" for Prolog, with a couple fairly substantial projects at the end. "Learn Prolog Now" (http://www.learnprolognow.org/) is free online, but a bit basic.

CTM has a great chapter on relational programming and Prolog, too - Peter Van Roy worked on Aquarius Prolog (http://www.info.ucl.ac.be/~pvr/Peter.thesis/Peter.thesis.htm...), and he also follows up with constraint programming. I highly recommend using a Prolog with constraint programming libraries, because it will make a big difference when Prolog's default behavior is too naive.

I would recommend learning Prolog, because it's sufficiently different from every other language that it will change the way you think, and even if you never use it in production, it's an excellent prototyping language. As a bonus, learning Prolog will help with Erlang, and vice versa. (Erlang was initially a DSL on SICStus Prolog, and many Prolog idioms came along.)

Re:The Prolog Story by rdtsc on Thursday May 20, 2010 @11:35AM (#1364259)
> As a bonus, learning Prolog will help with Erlang, and vice versa. (Erlang was initially a DSL on SICStus Prolog, and many Prolog idioms came along.)

As far as Erlang I have always been put off by the lack of backtracking. They took the best feature from Prolog and threw it out. Everything else is already strange and quite awkward, and those are the parts they kept but threw away backtracking. (I am looking at Elang as a general purpose language here, I know that there is no need for backtracking in a realtime telephony system).

By the way, if you want to experiment with prolog try SWI prolog. It's open, it has an IDE and a bunch of modules, including support for CHR (constrain handling rules).

http://www.swi-prolog.org

Ubuntu has it in its apt repository so you can just install from there.

Re:The Prolog Story by JustAGeek on Thursday May 20, 2010 @09:38AM (#1363967)
When you say "newer edition", are you referring to the edition from 1994 or is there an even more recent one?
Re:The Prolog Story by silentbicycle on Thursday May 20, 2010 @09:46AM (#1363984)
Newer and older are '94 and '86, respectively.

The (at the time de-facto) standard for Prolog shifted between the two editions, and the latter has several more chapters with larger example projects. Still, the core of the book is about logic programming itself, with Prolog is used an example language.

Re:The Prolog Story by JustAGeek on Thursday May 20, 2010 @09:58AM (#1364012)
Ok, thanks!

Turns out it's still available at Amazon.de, just ordered it along with "Clause and Effect".

Re:The Prolog Story by jm4 on Thursday May 20, 2010 @09:53AM (#1364001)
http://pragprog.com/titles/btlang/seven-languages-in-seven-w...

Keep in mind you will not learn enough about any of these languages that you can run off and build something. Each chapter covers a different language and primarily discusses some of the features of each that you may not see in another. It's kind of like a programming language buffet where you can have a small taste of a bunch of different things.

Re:The Prolog Story by silentbicycle on Thursday May 20, 2010 @11:35AM (#1364258)
CTM (http://www.info.ucl.ac.be/~pvr/book.html) is a similar treatment, but covers about a dozen programming models (paradigms' trade-offs, semantics) rather than languages. Comparisons between languages can often get bogged down in surface details.