7 ms·
Prolog Programming Language (1997)
- angersock 12y agoThe first time I read about Prolog, I thought to myself, "Man, this is what computing was supposed to do for us! Look at it answering questions, doing planning...holy cow." And in the last 40 years? Maybe Erlang (a Prolog descendant), Ruby (maybe the best successor to Lisp/Smalltalk), or Elixir (an Erlang descendant looks like Ruby) is as impressive. The rest is either hacky (C++, Javascript, Perl), attempts to clean up hackiness (Java, D, Go, Rust, Clojure), unoriginal (Python, C#), or just plain wanky (OCaml, Haskell)--and that's not counting ones that are beneath mention (PHP). Don't get me wrong...there are some languages that are actually quite beautiful in their implementation or use (Lua, Clojure, a few others), but the "holy shit this is the future!" feeling I get from looking at Prolog, Erlang, or Ruby is something I haven't had in a while. Instead, the future of practical programming languages is probably going to be yet another tepid iteration on Algol, with closures and memory safety and incorrectly-handled numerical safety and some lame concurrency story. Pattern matching if history is slightly kind to us, probably still no mandatory tail-call optimization. Sigh. Go is the future, I guess?
- walterbell 12y agoWhat do you think of Awelon? https://github.com/dmbarbour/awelon/blob/master/AwelonProject.md https://github.com/dmbarbour/awelon/blob/master/AwelonProjec... "My goal is to unify programmer experience (PX) with the user experience (UX). This is an elusive goal. It has been pursued for many years, with many different hypotheses for what such a unification might entail and how it might be achieved. Related projects include Squeak Smalltalk, ToonTalk, LambdaMOO, Morphic, Croquet, Emacs, and HyperCard. A relatively successful effort to unify PX and UX was the Unix command line, where users would build short programs of process pipelines. But that has been marginalized by the development of GUI. To me, the unification of PX and UX means that programming becomes a casual effort, such that users make it part of their normal workflow and don't even think about it as programming."
- agumonkey 12y agoWeird, I read some of dmbarbour's articles from a RSS feed, but I never read the basis for its awelon project, basis that have been an obsession of mine for quite a while. Thanks.
- seanmcdirmid 12y agoThe problem of Prolog is basically the history of AI: curated logic has mostly failed to live up to expectations and given away to various machine learning techniques. The Prolog approach was blamed for the second AI winter; Japan bet big on it in their 5G computing project (and lost big on it also) [1]. However, the paradigm lives on and is quite successful in various rule-based business logic systems; it just isn't very appropriate for general computation. Plenty of languages try to invent the future, but they are quite research projects in the spirit of the original prolog (which wasn't even implemented until it went into someones dissertation). The languages that actually hit production are quite conservative in comparison, since they kind of have to be. Anything more radical, you might just write off as even more wankier than OCaml and Haskell. Go is the present, perhaps, not really the future. [1] http://en.wikipedia.org/wiki/Fifth_generation_computer http://en.wikipedia.org/wiki/Fifth_generation_computer
- Chinjut 12y agoWhat does "wanky" mean in this context?
- andolanra 12y agoI think a charitable reading is 'excessively academic and not concerned with the real day-to-day aspects of programming', which is a common characterization of languages like Haskell and OCaml, albeit one I'd contest. (A less charitable reading, on the other hand, would likely invoke the commonly-cited Blub Paradox from http://www.paulgraham.com/avg.html http://www.paulgraham.com/avg.html )
- angersock 12y agoSo, that's not entirely it, though thank you for the opportunity of introspection. The reason I say "wanky" is that there doesn't seem to be in the popular rhetoric a clear practical reason for their existence beyond "we need this language". C? "Writing assembly sucks". C++? "Writing C for large project sucks". Java/D/C#? "Oh god C++ is worse than we thought". PHP? "We need to write web servers". Perl? "We need to munge strings". Ruby? "We need to be happy, and long-term exposure to Perl prevents that". COBOL? "We need to write a lot of business software". VB? "We need to write a lot of business software, and are on the MS stack". Fortran? "We need to write a lot of numerical code, and it has to be fast". Erlang? "We need to write distributed, fault-tolerant systems and all we have is C and Prolog". Elixir? "Erlang is awesome but hurts our eyes". APL? "We don't have computers yet, but we still need to write about them". Lisp? "We also don't have computers yet, but we could maybe implement our way there". Ada? "Wow, we can't trust C programs for anything". R? "We need to do statistics". Lua? "We need to be easily embeddable, and Brazillian." The same can be said about Smalltalk, SQL, Javascript, Eiffel, and many other languages. Even academic languages and systems (Scheme, ML, Coq, Simula, Io) were exploring something in particular. Hell, at least Elm had the clear objective "We want to be Haskell, but in the browser". Haskell? Haskell seems to be mainly "man, we should define a standard compilable functional language". Its syntax is nothing special if you've been exposed to other ML-descended languages (OCaml, F#), or a language (say, Erlang) which allows pattern-matching. Its a compilable, statically-typed, lazily-evaluated functional language with immutable data...which is not super interesting if you've seen or dealt with other languages. The bigger problem I have, honestly, is one of branding. The Scheme folks never pretend that theirs is a language that will save programming, merely an exercise in purity and peacefulness like a sort of digital taoism. C programmers, on the whole, never pretend that their language is anything more than the moral equivalent of moving a mountain with only a spoon and stern frown. Java and C# programmers don't seem to claim to be anything more than a sort of Stalinist human wave tackling the problems of enterprise. Even the Rubyists and Javascript programmers have a sort of cheerful guilty pleasure that they get paid as much as they do to have fun with computers and the Internet--and they never claim to be some sort of evolutionary step in computing. Haskell programmers, though? Haskell folks? Every one of them that I've chatted with seems to be cut from basically the same sort of cloth: quite smart, rather academic, and pretty much useless for any sort of real production programming. Theirs does not appear to be a culture well-suited to product development, to software engineering, to simple explanation or acceptance that most products and business needs are best met with tools of expediency instead of beauty or purity. Indeed, as outlined above, I find many Haskell people seem to be using a tool few care about to solve problems nobody has in ways that have been solved before, all the while viewing themselves as intellectually superior to the lesser "blub" programmers who are, you know, getting paid, and working on projects way more interesting than whatever the Haskell folks are posting on /g/ about.
- agumonkey 12y agoIdris and its siblings is quite futuristic. Prolog (and other logic programming like kanren) was even weirder than that, it felt timeless; out of the map. Seeing demos of embedded interpreters for inverted evaluation was unbelievable.
- ScottBurson 12y agoProlog never delivered on the promise of declarative programming, because its rigid, unintelligent depth-first search strategy makes it necessary to understand the execution model and keep it in mind when writing programs. So it's only mostly declarative. Prolog achieved some popularity because there are times when brute-force depth-first search is all you need, particularly if it can be done very fast; but once you bump against the limitations of that paradigm, Prolog is of little help. True declarative programming is still an open research problem.
- JoelHobson 12y agoAre there any modern logic programming languages? I've tried looking for them before, but found nothing.
- dozzie 12y agoMozart/Oz perhaps? Multiparadigm, true, but includes logic programming according to my knowledge.
- kyllo 12y agoThere's minikanren which is a library that's implemented in many different languages. Have a look at Clojure's core.logic for an example.
- wk_end 12y agoI can't say I've tried it myself, but Mercury looks interesting: http://en.wikipedia.org/wiki/Mercury_%28programming_language%29 http://en.wikipedia.org/wiki/Mercury_%28programming_language... http://www.mercurylang.org/ http://www.mercurylang.org/
- rdtsc 12y agoParts of the "logic" component has been relegated to libraries -- rule based system, constraint programming, databases (see Datomic and its Datalog based querying languages).
- saretired 12y agoFor constraint logic programming, ECLiPSe: http://eclipseclp.org/ http://eclipseclp.org/ It extends Prolog in various ways and was open sourced by Cisco a few years back.
- tluyben2 12y agoNow that Shen is BSD it is great opportunity to work with a mix of Prolog and a LISP (and much more). http://www.shenlanguage.org http://www.shenlanguage.org
- exDM69 12y agoNo and yes. I don't know of a "modern" logic programming language that is a standalone language (they might exist but are not too popular), but there are several embeddable logic programming languages. Clojure's core.logic is perhaps the most popular one, but there are others too. And Prolog itself can be embedded in several different languages. And this makes all the sense in the world, Prolog isn't a very practical programming language for tasks that are not logic programming (or some variant thereof - like fuzzy logic). So it's nicer to have a logic programming language either as an embedded domain specific language (EDSL) or available as a library. Implementing a Prolog -like language isn't too difficult (and it's very fun) so sometimes it might be more practical (or fun) to whip up a custom language for that purpose, perhaps with domain specific variations applied. And besides, Prolog is "modern" in the sense that there are actively maintained and used implementations available. Like Lisp, it has stood up well to the test of time (perhaps because Lambda calculus and Predicate logic are solid theoretical foundations to build on), and there are modern implementations available even if the language itself is decades old.
- jplahn 12y agoWe had to use Prolog in my comparative languages class last semester and it was interesting, to say the least. With any class that brushes over a topic, I didn't get a full appreciation for what it can do, but it was an interesting paradigm to be exposed to if nothing else. I didn't feel like I was doing "real programming", which likely says more about what we're taught than the merits of the language. I'd be interested to known how it's being leveraged presently? I know a lot of the standard use cases, but is there anyone solving really unique problems with it?
- seanmcdirmid 12y agoWe also studied Prolog for a week in my undergrad PL class (back in...1997?), but we never got to "cut" where things start getting really messy.
- jplahn 12y agoYep, the extent of any programming we did with it was writing a bunch of facts about family relationships and then asking questions about relationships. Basic stuff. It was interesting, but hardly ground breaking.
- ditonal 12y agoI think declarative programming is real programming. The most obvious use case is when you have some sort of list of rules or constraint satisfaction problem. Gerrit uses its for that use case: https://gerrit-review.googlesource.com/Documentation/prolog-cookbook.html https://gerrit-review.googlesource.com/Documentation/prolog-... One of my college professors has a language that's heavily influenced by Prolog and designed to solve NLP problems called Dyna (I think because many NLP parsing problems can be solved by dynamic programing approaches that logic programs can easily express and optimize for). https://github.com/nwf/dyna https://github.com/nwf/dyna I actually think the real reason we don't see more Prolog or Prolog-like languages is not because they are bad approaches, but because it's relatively easy to make your own half-baked constraint satisfaction backtracking solver in a language like Python, and then write rules for it to evaluate, so smart people just write it that way rather than busting out Prolog. http://norvig.com/sudoku.html http://norvig.com/sudoku.html
- yarrel 12y agoProlog is one of those languages that's worthwhile to learn even if you never use it. Try the Zebra problem, Towers of Hanoi or a family tree example to get a feel for what it's like.
- MonkeyIsNull 12y agoNot only is it worthwhile to learn, it's worthwhile to use for real world problems: https://www.youtube.com/watch?v=G_eYTctGZw8 https://www.youtube.com/watch?v=G_eYTctGZw8 From his blog: http://blog.ndrix.com/2014/10/how-we-use-prolog.html http://blog.ndrix.com/2014/10/how-we-use-prolog.html
- tkosan 12y agoI started learning how to program in Prolog a few years ago. I found Prolog to be very difficult to understand, mostly because I did not understand what symbolic logic was. I then purchased a significant number of books on symbolic logic and started studying them. I don’t think it is possible to understand Prolog without first understanding how symbolic logic works. My recommendation for someone who is interested in learning how to program in Prolog is to start by reading “Logic for Problem Solving” by Robert Kowalski: http://www.amazon.com/Problem-Solving-Revisited-Robert-Kowalski/dp/3837036294/ref=oosr http://www.amazon.com/Problem-Solving-Revisited-Robert-Kowal... I am currently about halfway through an earlier edition of this book, and it is the first book I have found that clearly explains the ideas upon which Prolog is based.
- MonkeyIsNull 12y agoThis looks amazing, thanks for posting.
- deleted 12y ago[deleted]