Ask HN: Anyone use Prolog?
1. What did you use it for?
2. What are your thoughts about the language? Why did you choose Prolog, and were you happy with it?
3. How does performance, development time, etc. compare to other languages?
1. What did you use it for?
2. What are your thoughts about the language? Why did you choose Prolog, and were you happy with it?
3. How does performance, development time, etc. compare to other languages?
In a fit of juvenile rage, I wrote it in Prolog, even though it really wasn't particularly well-suited to being expressed that way. Apparently rather than tell anyone that he didn't understand how it worked (in spite of my fairly good documentation), he just pretended to be updating it for a couple years after I left.
Eventually the ruse was discovered, and they got rid of him.
I've been carrying that load around for the past twelve years, it feels nice to share it.
Prolog is not really a general-purpose language, so asking how it compares in "performance, development time, etc." is rather missing the point. If you have a problem for which Prolog is suitable, it will be easily the fastest way to solve the problem. But I wouldn't build a Web app in Prolog.
I'm afraid the only way to really get a feel for what it's good for is to write some programs in it. But it's a good tool to have in your toolkit.
It's a very nice little language for rule processing, and it has served our needs well. It is unlike most other programming languages in that it's declarative as opposed to procedural, and that can take some getting used to. Our primary motivations for choosing it at the time were that (1) it was a "rules" language with which we were already familiar and (2) its license permitted its use in commercial software (unlike Jess, which was another contender).
As ScottBurson has already noted elsewhere in this thread, it's not exactly a general purpose programming language. We for example used it as just one component of larger Java-based applications. Its performance, at least for the implementation that we chose, is not great, but there's a performance-flexibility tradeoff: if the alternative is to write-up a bunch of nested if-then statements in Java, and to have to recompile that every time the rules change, I believe that Prolog comes out ahead in terms of development time.
Story (and a little video) here:
I haven't read that particular book, but I imagine Prolog was included because it being a declarative language fits a paradigm of its own.
Use it for random puzzles like http://chris-lamb.co.uk/2010/07/24/four-men-mine/ though