News for hackers. Stuff that matters.
Re:Prolog for Programmers by roberthahn on Friday December 13, 2013 @02:35PM (#6902417)
I found this (closed) SO question asking what Prolog is good for in the real world. (http://stackoverflow.com/questions/130097/real-world-prolog-...)

I think it's a great question, so I'm going to re-ask it here: What do YOU use Prolog for?

One reason why I'm interested in Prolog is because I used to work at a semantic web company[1], and it seems to me like Prolog could work well in that domain.

Thanks for posting this resource. I'd love to learn more. So much to do, so little time!

[1]http://primal.com/

Re:Prolog for Programmers by Vektorweg on Friday December 13, 2013 @04:58PM (#6903146)
I try to write a little database system in Haskell, inspired by Prolog, because it seems very natural and simple to query Prolog. If you have lots of different relations between data, Prolog is a good choice.
Re:Prolog for Programmers by _nato_ on Friday December 13, 2013 @11:24AM (#6901314)
The father of Erlang, Joe Armstrong, lauds this language every time he gets a chance. And I think the hate on Erlang syntax comes from the fact that a first stab at Erlang was done with Prolog. But I actually like the Erlang syntax after I got used to it. It reads like English ~
Re:Prolog for Programmers by fcatalan on Friday December 13, 2013 @04:09PM (#6902938)
There's a great article describing the start of Erlang as a Prolog metainterpreter. It's very accessible, at least I can follow it with my month old Prolog knowledge and it's quite impressive to watch as the interpreter goes from nothing to basic concurrency in a few lines of code:

http://www.sics.se/~joe/pubs/prac_appl_prolog.ps‎

I'm taking a class that has some Prolog content and I've been playing with my own toy implementation. Fun stuff.

Re:Prolog for Programmers by brickcap on Saturday December 14, 2013 @11:09AM (#6905990)
> It reads like English

My sentiments exactly. Atoms and pattern matching make my programs highly readable.

When I was starting out in erlang I read a lot of complaints on erlang's syntax. But after a day or two I got comfortable around it.

Re:Prolog for Programmers by anth1y on Friday December 13, 2013 @02:27PM (#6902362)
Is there a more accessible intro to Prolog for someone who is a sysadmin and is trying to write more code.
Re:Prolog for Programmers by YAYERKA on Friday December 13, 2013 @03:04PM (#6902599)
I've looked at and read a bunch of different Prolog books. In my opinion the best one is `Programming in Prolog: Using the ISO Standard' by Clocksin & Mellish. It's actually one of my favorite programming books. Do all the exercises!

http://www.amazon.com/Programming-Prolog-Using-ISO-Standard/...

http://www.swi-prolog.org/

Re:Prolog for Programmers by nmk on Friday December 13, 2013 @03:37PM (#6902762)
If you are looking for an on-line resource nick_dm's suggestion for http://www.learnprolognow.org/ is spot on.

If you would like a book, I cannot recommend "The Art of Prolog" by Sterling and Shapiro enough. It gives a very understandable introduction to the language and is focused on teaching you how to approach different problem spaces while "thinking" in Prolog.

Re:Prolog for Programmers by nick_dm on Friday December 13, 2013 @03:03PM (#6902587)
I recently started reading http://www.learnprolognow.org/ and the first few chapters have been excellent. There are exercises and practical sections at the end of each chapter too (unfortunately I haven't had time to look at them in detail yet).
Re:Prolog for Programmers by anth1y on Friday December 13, 2013 @07:04PM (#6903670)
Thanks everyone much appreciated
Re:Prolog for Programmers by Shamanmuni on Friday December 13, 2013 @02:37PM (#6902432)
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!

Re:Prolog for Programmers by nrub on Friday December 13, 2013 @04:01PM (#6902893)
Check 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

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.

Re:Prolog for Programmers by seanmcdirmid on Saturday December 14, 2013 @06:39AM (#6905412)
Its 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.

Re:Prolog for Programmers by brudgers on Friday December 13, 2013 @08:33PM (#6904093)
Logic 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.
Re:Prolog for Programmers by nextos on Friday December 13, 2013 @03:18PM (#6902674)
Maybe you should read CTM, which illustrates many paradigms.
Re:Prolog for Programmers by ics on Friday December 13, 2013 @04:07PM (#6902931)
The book (not freely available AFAIK): http://www.info.ucl.ac.be/~pvr/book.html

Paradigms map: 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.

Re:Prolog for Programmers by justin66 on Friday December 13, 2013 @05:07PM (#6903181)
There's a draft of the book on one of the author's websites: 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.

Re:Prolog for Programmers by pjungwir on Friday December 13, 2013 @02:54PM (#6902534)
I had a taste of Prolog in college and always wanted to learn more, especially after reading this Dr. Dobb's article about using it for a vaccine scheduling app:

http://www.drdobbs.com/database/building-a-custom-rule-engin...

With all the interest these days in DSLs, I feel like knowing when/how to embed Prolog into larger applications could be a great tool in my toolbox.