Plus, I thought it was entertaining to see this on the front page at the same time as "Hello, declarative world" :)
[1] https://en.wikipedia.org/wiki/Fifth-generation_programming_l...
It was a real joy to work with semantic web data in SWI-prolog! Prolog lets you raise your level of abstraction so quickly, as defining prolog rules basically is a form of creating "named queries", something that is not possible e.g. in SPARQL (the canonical semweb query language).
I can't understand why this feature of prolog is not implemented more widely in more recent systems. The only example I know of that does, is Datomic [2], by Rich Hickey.
[1] http://www.diva-portal.org/smash/record.jsf?pid=diva2%3A3988...
I had it in the trading system for some time but I had to pull it out as I couldn't find a way to make its runtime deterministic enough. Most of the time it would be great and then on occasion I'd get 100 millisecond pauses:( I could never figure out if it was me doing something, the C bindings we were using or if Prolog just has a mind of its own:)
If anyone has any pointers on how to reason about the run time efficiency and performance of your prolog code I'd be willing to buy you a coffee!
http://www.amazon.com/Programming-Artificial-Intelligence-In...
Awesome book, can usually be found in any used university book store!
As a first guess, this sounds like garbage collection pauses. Details of what to do about them depend on the particular implementation.
In SWI you can use the profiler to see if the garbage collector is in fact being called when you don't expect it. Then: (a) change the default (veeery low) garbage collector settings to use more memory before collection is triggered; (b) make sure you're not leaving unnecessary choice points around (listed as "redo" by the profiler, fix with correctly placed green cuts); (c) call garbage_collect/0 yourself at well-defined points when you're currently not doing low-latency stuff; (d) possibly (but I have no personal experience with this) turn off the garbage collector completely for certain sections of the code.
I'm not familiar with Prolog GC but in other systems, making GC less frequent just tends to cause each collection to take even longer, as more objects have been created between each pass.
So, to reiterate: You are right in broad terms, but it all depends very much on the details of the application.
DTrace, my friend. If DTrace didn't point you in the right direction with a one-liner, I would have been surprised.
http://fogbeam.blogspot.com/2013/05/prolog-im-going-to-learn...
Sadly I've only just now finally gotten around to investing some time in to trying to learn Prolog myself. I got as far as creating myself a Github repo[1] and writing "Hello, World" and figuring out how to run Prolog programs at least. It's not much, but ya gotta start somewhere.
Still, my long streak is only 14 days so far. :-(
Also, maybe I misunderstand, but doesn't using Prolog limit you to the unification algorithm used? If you wanted to build something like the Cassowary constraint solver in Prolog would it be really easy or would you still need to implement the algorithm from scratch?
It can be -- and often is. Depending on the language, the syntax may not be as convenient as using Prolog directly.
What do you want to know? I have written a few thousand lines each of production-quality Prolog in two distinct projects. It works well if you know what you're doing, the problem domain is a good match, and you don't need to rely on bindings to loads of external libraries. If you don't know what you're doing, it's easy to write slow and buggy code.
Edit: and oh, almost forgot: http://docs.racket-lang.org/racklog/
Yep. Watson has been described as "mostly written in Java, with some chunks in C++ and some in Prolog"[1]. The Prolog is apparently mainly used for language parsing[2].
Also the open source UIMA[3] project is heavily used by Watson. UIMA started out as an IBM project called OmniFind (IIRC) and was later donated to the ASF.
[1]: http://www.drdobbs.com/jvm/ibms-watson-written-mostly-in-jav...
Compared to when DCG parsing was most popular ('70s-'90s), there are now more alternatives for easily working with grammars, though, including non-black-box approaches nicely integrated into languages, like combinator parsers in Haskell and LPeg in Lua. So it's not quite as unique today, though it's still a nice way to prototype parsers.
https://web.archive.org/web/20150913080629/http://www.swi-pr...
Here's the same thing in modern Python: https://news.ycombinator.com/item?id=10221707