4 ms·
I'd like to learn Prolog and Logic Programming but I don't know when it's better than the other paradigms, its shining moment. Could anybody help me? I mean, I
by Shamanmuni 13y ago
I'd like to learn Prolog and Logic Programming but I don't know when it's better than the other paradigms, its shining moment. Could anybody help me?
I mean, Imperative Programming shines when you aim for efficiency in the usage of the computer resources. Functional Programming shines when you need concurrency and parallelism. Object Oriented Programming shines when you are building a GUI. All these paradigms have their sweet spot and will make your life easier in certain situations.
What's Logic Programming sweet spot? I've read about puzzle games as good examples for this paradigm, but I suppose there are stronger examples for it. Maybe AI? Is it used in that field?
Edit: I have just read roberthahn comment, thanks for your insight and the link!
- nextos 13y agoMaybe you should read CTM, which illustrates many paradigms.
- ics 13y agoThe book (not freely available AFAIK): http://www.info.ucl.ac.be/~pvr/book.html http://www.info.ucl.ac.be/~pvr/book.html Paradigms map: http://www.info.ucl.ac.be/~pvr/paradigms.html http://www.info.ucl.ac.be/~pvr/paradigms.html "Read CTM" may be good advice in general, but at ~900 pages probably isn't the type of answer they're looking for.
- justin66 13y agoThere's a draft of the book on one of the author's websites: http://www.sics.se/~seif/DatalogiII/Book/datalogiII.pdf http://www.sics.se/~seif/DatalogiII/Book/datalogiII.pdf I'm pretty sure there's a newer still (and legitimate) pdf of the book out there if you're good with the google. The book itself is absolutely worth buying but the pdf might give you an idea of what you're getting. Peter Van Roy is giving a class in a month or two on one of the MOOC platforms which looks like it will be a pretty gentle intro to the material. I don't know which paradigms he's going to be covering - he's not going to go through the entire book.
- nrub 13y agoCheck out Datalog the query language used to interact with Datomic, www.learndatalogtoday.org William Byrd & Daniel Friedman wrote a book called the Reasoned Schemer, which walks through the implementation of a Prolog like logic language called MiniKanren, check out a recent presentation they gave where they show quite a few interesting examples and uses, http://2013.flatmap.no/danwill.html http://2013.flatmap.no/danwill.html I know this is not a definitive answer, but having a look at those resources may highlight some of the areas where logic programming can be very useful.
- seanmcdirmid 13y agoIts also not that hard to build a backward (prolog) or forward (datalog) chaining predicate rule system in whatever your favorite language is; as a bonus, you'll get to learn the joys of unification, or go crazy with some higher order predicates. Once you get bored with unification, then look at dealing with inequalities and learn some constraint solving. Prolog and datalog look quite simplistic compared to some of the more developed logics out there.
- deleted 13y ago[deleted]
- brudgers 13y agoLogic programming is about specifying what is wanted without worrying about the methods used to produce it [beyond the correctness of the methods]. SQL shines a bit of light on the subject at a less abstract level (relational algebra). Writing a query describes the result, and does not address the algorithms used to calculate it, nor does it even depend on the actual way in which the data is organized - if the interface is there, that's all that matters.