

Ask HN: Modern Uses for Prolog? - biscarch

I like Prolog, but I don't know of any modern applications for it. I've heard rumors of a Common Lisp Prolog implementation. It seems like it might be useful in relation to graph databases (Titan, neo4j).<p>I'm coming from a position of enjoying languages like Haskell, Clojure and JavaScript so weird syntax, etc, aren't really concerns of mine.<p>Has anyone used Prolog in the last year to build something that couldn't easily be done in other languages? Or maybe there is a fairly new language that supersedes Prolog?
======
mjn
Well, this is something I'm interested in.

AnsProlog, which is Prolog-esque syntax implemented via answer-set programming
(<http://en.wikipedia.org/wiki/Answer_set_programming>) is a language that's
heavily derived from Prolog, and an active area of research. It's solver-
based, however (roughly like a SAT solver), which comes with pros and cons.

I used both Prolog and AnsProlog in a project to model and query videogame
mechanics. The idea is to prototype a game's core mechanics in Prolog, and
then be able to both play the game and query properties of it. We use Prolog
to actually run the game, and mainly ASP to perform queries (because it allows
adding various constraints). Sticking to a subset it's possible to run the
same code in both, with some mechanical syntax translation.

Possibly a somewhat esoteric example, and definitely researchy, but imo Prolog
and/or ASP still have promise in a number of areas. Prolog retains some
advantages over the newer ASP in that it doesn't ground out to a propositional
solver, which can make it faster in some cases (especially in large domains),
and can do imperative-type stuff (there are even GUI bindings), while ASP is
purely a formal solver. ASP's advantage is more flexible modeling (e.g. you
can have elements of constraint programming), more active research community,
and cleaner semantics in some areas, e.g. circular references can be solved.

A few sources:

[1] My collaborator's blog post on that project: <http://eis-
blog.ucsc.edu/2009/06/you-have-to-mine-the-ore/>

[2] A paper on it:
[http://www.aaai.org/ocs/index.php/AIIDE/AIIDE09/paper/viewFi...](http://www.aaai.org/ocs/index.php/AIIDE/AIIDE09/paper/viewFile/690/1061)

[3] An op-ed I once wrote, "Why did Prolog lose steam?"
<http://www.kmjn.org/notes/prolog_lost_steam.html>

~~~
biscarch
Interesting reading.

Can Biped be used to model more complex games, such as Halo or Assassin's
Creed, or is it targeted at 2D games like checkers or Motherload?

In [3] you mention that some researchers in the 70's started working on
Datalog. Is this the same Datalog query language used in the Datomic database?
_1

_ 1 Datalog is in video #2 here: <http://blog.fogus.me/2012/03/05/datomic/>

