News for hackers. Stuff that matters.
Re:Prolog's Death (2010) by gavanwoolery on Friday May 10, 2019 @05:42PM (#19882521)
Prolog is a terrible "programming language" - and I would never try to use it as such. But it is (at least conceptually) an excellent query language. In that regard, it is much closer to SQL, as is its domain of reasonably applicable problems.

Clarification: I dont actually think prolog is terrible (I credit it as the most exciting language I have ever learned), I just mean its not intuitive to "program" with in the imperative sense of telling a computer what to do. What I mean by it is excellent as a query language is - given a set of data, it is great for drawing conclusions from that data (but not in the same way as a "traditional" query language like SQL).

Re:Prolog's Death (2010) by basetop on Saturday May 11, 2019 @09:54AM (#19886154)
It is a declarative language like SQL. If you come from traditional imperative programming side, it is very difficult for you to get used to. I forgot who said it : "With imperative style, you code the precise steps to get what you want. With declarative style, you describe what you want and you let the language/runtime/OS/etc get it for you."

If you're used to C/C++/Java, then SQL or Prolog seems frustrating, unnatural and non-intuitive. But once you have the eureka moment and realize they are declarative, you appreciate the elegance and power of SQL or Prolog.

Re:Prolog's Death (2010) by segmondy on Friday May 10, 2019 @05:56PM (#19882622)
Terrible programmers often get defeated by Prolog. If you can't bend Prolog, don't blame prolog, blame yourself. :D
Re:Prolog's Death (2010) by gavanwoolery on Friday May 10, 2019 @07:03PM (#19883102)
I like Prolog, I just think that trying to use it as a traditional programming language for an average task is like using a sponge to bail water out of a boat - you can do it, but it is hardly the most effective tool. :) That said, there are very specific problem domains in which Prolog excels.
Re:Prolog's Death (2010) by alfiedotwtf on Saturday May 11, 2019 @08:02AM (#19885749)
You may also want to check out Mercury:

    https://www.mercurylang.org/
Re:Prolog's Death (2010) by tluyben2 on Sunday May 12, 2019 @04:09AM (#19890768)
Can not recommend this enough. Prolog with great typing.
Re:Prolog's Death (2010) by alfiedotwtf on Friday May 10, 2019 @08:33PM (#19883603)
I find it reminds me a lot like Neo4j's Cypher, and I've been wondering how hard it would be to hook up Neo4j as a backend as Prolog's datastore
Re:Prolog's Death (2010) by YeGoblynQueenne on Friday May 10, 2019 @05:55PM (#19882616)
Prolog is not a good language for querying databases (if that's what you mean by "query language"). Foe one thing, it lacks a SELECT statement or list comprehensions and the like. If you want all results of a goal, you have to use one of the bagof/setof/findall predicates, or roll your own.

On the other hand, Prolog programs are logic theories (as are Prolog queries) and their executio is a proof. The range of programs that can be expressed in Prolog is the set of programs that are computable by a Turing machine. So yes, Prolog is a programming language. Whether it's "terrible" or not is up to personal taste.

I mean, I don't konw of an objective measure of what makes a programming language "terrible".

Re:Prolog's Death (2010) by marcosdumay on Friday May 10, 2019 @10:01PM (#19884045)
Software has evolved on a direction where sending sets around is natural. That is no evidence that sending theorems around is problematic, it's just that current communication implementations happens to be very data-friendly and logic-unfriendly.

There is probably a very human reason for that, but mathematically both representations are perfectly replaceable.

Re:Prolog's Death (2010) by guicho271828 on Friday May 10, 2019 @06:59PM (#19883069)
bagof/setof/findall ARE indeed list comprehensions, aren't they
Re:Prolog's Death (2010) by gavanwoolery on Friday May 10, 2019 @06:45PM (#19882972)
agree with you - added clarification to my original comment :)
Re:Prolog's Death (2010) by archgoon on Friday May 10, 2019 @05:47PM (#19882552)
Hey; that sounds intersting; can you give an example of how you use Prolog in a SQL like context? How do you setup your 'DB'? How large does it scale?
Re:Prolog's Death (2010) by jcranmer on Friday May 10, 2019 @05:58PM (#19882647)
I've used Datalog (which is essentially a stripped down version of Prolog) in the past for a pointer analysis. Essentially, you literally print out the inference rules and then the basic facts to a text stream, and then you use interactive queries on the text stream.
Re:Prolog's Death (2010) by fiddlerwoaroof on Friday May 10, 2019 @05:56PM (#19882623)
You might look at how datomic or datascript use a limited subset of prolog (datalog, with a lispy syntax) to express queries: you end up doing things like:

    [[?person :name “Bob”]
     [?person :state :tx]]
To query for “the person named Bob who lives in Texas”
Re:Prolog's Death (2010) by fiddlerwoaroof on Friday May 10, 2019 @05:57PM (#19882639)
The Clojurescript web framework fulcro uses this also for the sorts of things graphql is used for.
Re:Prolog's Death (2010) by muydeemer on Saturday May 11, 2019 @05:21AM (#19885339)
You might find https://github.com/graknlabs/grakn of interest. Datalog was one of our main sources of inspiration. The query mentioned in this thread (the person named Bob who lives in Texas) would be something like:

$x has name 'Bob'; ($x, $y) isa lives; $y has name 'tx';