

Ask HN: Anyone use Prolog? - bendmorris

I'm working through "Seven Languages in Seven Weeks" (http://www.pragprog.com/titles/btlang/seven-languages-in-seven-weeks). The inclusion of Prolog seems strange to me and I've heard very few examples of Prolog being used in the real world. Has anyone here used Prolog in production, and if so:<p>1. What did you use it for?<p>2. What are your thoughts about the language? Why did you choose Prolog, and were you happy with it?<p>3. How does performance, development time, etc. compare to other languages?
======
m0nastic
I'm somewhat ashamed to admit that once in a former life I was tasked with
writing a program for a coworker who I absolutely hated as I was leaving. He
was going to have to maintain the program, and he wasn't really a programmer
(contrary to what he said on his resume).

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.

------
ScottBurson
I used it a few years ago to write a reference implementation for a language
feature whose real implementation was greatly complicated by the fact that it
had to work in real time. I used Prolog to generate many thousands of test
cases along with the correct result for each, then ran these through the real
implementation to see how the results compared.

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.

------
lylejohnson
We've used an Java-embeddable Prolog engine called tuProlog to provide the
reasoning capability in several applications.

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.

------
silentbicycle
Prolog is not a general purpose language, it's more like a database query
language. Many common tasks would be painful in Prolog (it's really awkward
for procedural code), but for rule-based systems, parsing, constraint
satisfaction problems, prototyping interpreters, etc., it's an outstanding
tool.

------
kylecordes
I used it a while back, to add some functionality that would have otherwise
required a lot more code and work.

Story (and a little video) here:

<http://kylecordes.com/2010/the-prolog-story>

------
sireat
Used it at the university, liked the idea of the language, but implementation
was sadly lacking. Not an easy language to debug.

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.

------
Ernestas
College. Lecturer said that in US they teach LISP and in europe Prolog. Edit:
AI lecture.

------
lamby
Never used in production, just cannot see how it would work.

Use it for random puzzles like <http://chris-lamb.co.uk/2010/07/24/four-men-
mine/> though

