4 ms·
I like how posts about Prolog get populular very fast, but have little to no comments. People have heard that this language is special but have never actually u
by penetrarthur 11y ago
I like how posts about Prolog get populular very fast, but have little to no comments. People have heard that this language is special but have never actually used it in production, so they hope that someone will shed the light on it. Unfortunatelly it usually ends with a copypasted list of 15 projects(including Watson) where Prolog is used and thats it.
Maybe someone can share his/her production level experience with it this time...
- mark_l_watson 11y agoIBM Watson uses Prolog? That is interesting. I have been helping a friend for a year integrate IBM Watson into his product, but I don't know much about how Watson is implemented.
- mindcrime 11y agoIBM Watson uses Prolog? 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-java/229300226 http://www.drdobbs.com/jvm/ibms-watson-written-mostly-in-jav... [2]: http://learning.acm.org/webinar/lally.cfm http://learning.acm.org/webinar/lally.cfm [3]: http://uima.apache.org http://uima.apache.org
- mjn 11y agoSome background on why Prolog for parsing: That was traditionally a popular use of Prolog, because something similar to BNF-style grammar rules can be written almost literally as Prolog clauses, and you get a parser for "free". Very easy to prototype, plus since it's just Prolog clauses that can be used by the rest of the Prolog program and vice versa (not black-box tables generated by YACC), you can muck with edge cases, integrate error reporting, call out to information-extraction heuristics where relevant, etc. The technique is "definite clause grammars" (DCGs), and can either be written directly in normal Prolog, or with some syntactic sugar that most Prolog implementations include. Here's a tutorial: http://www.pathwayslms.com/swipltuts/dcg/ http://www.pathwayslms.com/swipltuts/dcg/ 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.
- Johnny_Brahms 11y agoIf you want to play with prolog it is actually quite easy to implement. Languages like Shen have a fully functional prolog in the language. Maybe not with all the fun bells and whistles of bigger languages, but still enough to play around with. Edit: and oh, almost forgot: http://docs.racket-lang.org/racklog/ http://docs.racket-lang.org/racklog/
- tom_mellior 11y ago> Maybe someone can share his/her production level experience with it this time... 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.
- tikwidd 11y ago"Production Prolog" by Michael Hendricks: https://www.youtube.com/watch?v=G_eYTctGZw8 https://www.youtube.com/watch?v=G_eYTctGZw8
- hencq 11y agoI've never actually used Prolog, but like you say, it always seems like a really cool language. That said, I always wondered why it needs to be a language instead of just a library in another language. It seems there are some types of problems that are really well suited to Prolog, but I don't think it necessarily applies to all problems. So why not use another language and then bring in the relational piece as a library? Granted, I think that's what Kanren does in Scheme, but it doesn't really seem to be all that common. 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?
- dragonwriter 11y ago> That said, I always wondered why it needs to be a language instead of just a library in another language. It can be -- and often is. Depending on the language, the syntax may not be as convenient as using Prolog directly.
- sklogic 11y agoThat's exactly how I use Prolog - embedded in the other languages. It is especially invaluable inside compilers (alongside with an optimised Datalog). And I had to extend the default unification for implementing some exotic type systems.