4 ms·
In my opinion, Prolog is a horrible programming language. BUT... The idea of logical programming has much promise. Not for programming, but for running queries
by gavanwoolery 10y ago
In my opinion, Prolog is a horrible programming language.
BUT...
The idea of logical programming has much promise. Not for programming, but for running queries on a knowledge base. In fact, unification / lambda calculus is arguably the only way you can make complex logical deductions without a brute force approach (you could also use machine learning, but that would not scale for queries with many variables).
The only problem is, the domain in which this is useful is fairly small, and requires an explicitly defined knowledge base, whereas things like machine learning are very flexible and cover a broad variety of domains pretty well. One area I think it holds promise for is in games - imagine characters being able to make deductions about the world around them, and react appropriately - beyond things like behavior trees (which also do not scale once you have many complex rules interacting).
So...in my opinion it is a little bit like SQL. You would not use SQL to write an application (I hope!).
- qohen 10y agoThe idea of logical programming has much promise. Not for programming, but for running queries on a knowledge base. You might want to take a look at Datalog [0]: Datalog is a declarative logic programming language that syntactically is a subset of Prolog. It is often used as a query language for deductive databases. In recent years, Datalog has found new application in data integration, information extraction, networking, program analysis, security, and cloud computing. An example of this in real-world use would be in Rich Hickey's Datomic [1]: Datomic is a distributed database and implementation of Datalog on Clojure. It has ACID transactions, joins, a logical query language—Datalog. [0] https://en.wikipedia.org/wiki/Datalog https://en.wikipedia.org/wiki/Datalog [1] https://en.wikipedia.org/wiki/Datomic https://en.wikipedia.org/wiki/Datomic
- e12e 10y agoI've tried to get started with datablog a few times, but haven't yet been able to find a useful, Free/open software system that seems practical and has a good practical/hands-on tutorial? I'm thinking there ought to be something with usefulness comparable to sqlite or at the very least Berkley DB? But I've yet to find it.
- YeGoblynQueenne 10y ago>> So...in my opinion it is a little bit like SQL. You would not use SQL to write an application (I hope!). Not a bad hunch, but SQL is in a way only half of Prolog. SQL relations (tables) can be seen as first-order logic predicates that are always true. Prolog has those (they're called unit clauses, or "facts") but also has relations that are actually implications (called definite clauses, or "rules"). "Rules", being conditionally true (or not) allow programming logic to be described. [1] [2] The funny thing is that in Prolog both facts and rules are the same kind of thing (a special kind of first-order predicate called a Horn clause). In, er, fact, so are the queries you write at the command line (negative clauses which are always false, so that you can prove them true by refutation, binding variables in the process; this is how you "retrieve data" in Prolog, where your program is your data). In this sense Prolog is very different to SQL, which has a clunky syntax on top of a neat abstraction- in Prolog you program with the abstraction itself so, yes, totally: in Prolog you use the database to write an application. Except it's not a SQL databse. [1] https://en.wikipedia.org/wiki/Horn_clause https://en.wikipedia.org/wiki/Horn_clause [2] http://mathworld.wolfram.com/HornClause.html http://mathworld.wolfram.com/HornClause.html
- gavanwoolery 10y agoI agree - I did not clarify very well, but what I meant is that it is like SQL in that it is probably best utilized with an accompanying language. :)
- pjmlp 10y agoI imagine you never had the fortune of using Oracle Forms or its replacement Apex.
- gavanwoolery 10y agoI have not :)