views:

166

answers:

3

today i have talk with other friend ,he said he has logic programming skill , so I am very curious about that.

A: 

I would take that statement to mean, "I can program if/then/else statements". Or in other words, I would take that statement to mean, "I can't program with any real technology". I would not be impressed.

Jaxidian
A simple Google search would have immediately shown your assumption to be false. http://www.google.com/search?q=logic+programming
John
I just clicked the first link of your search and it seems to confirm my thoughts. :-/ I'd say pretty much any developer should be able to slap together some conditionals and work with them. Ands, Ors, Nots, they're all pretty basic and completely technology-agnostic. If you think this google search is showing my assumption to be false, then what exactly are you assuming my assumption is? I've interviewed a good number of people over the past few years and if I asked them "What kind of programmer are you?" and their answer was "A logic programmer", the interview would pretty much be over.
Jaxidian
Let me restate this last comment in a more concrete fashion. A developer SHOULD be good with logic programmer - this is something that is usually assumed as a minimal requirement. A developer should NOT have issues with logic.
Jaxidian
Programming with Prolog isn't quite the same as throwing up if/else statements. It's more akin to SQL, in that it's programming with sets (of boolean values), and the flow can be quite tricky to pin down. For example, try checking out an `append` function in Prolog. Logic programming is vague enough that it could indeed mean many things (also why the wikipedia article is so vague), but I'd take it to mean prolog and the like.
Svend
@Jaxidian: Logic programming is not even close to the same thing as saying "I program with logic" just as Functional Programming isn't even close to saying "I program with functions". However, object oriented programmers do in fact program with objects as well as functions and use logic. I'm a pretty good C# developer but would not call myself a logic programmer or a functional programmer.
John
BTW: To answer your question, I assumed your assumption (small bit of recursion there ;)) was that because someone knows how to use if/then/else that means they are a logic programmer and that is not a positive trait. Neither of which are true. Just like someone who knows how to write a function can't call themselves a functional programmer, someone who knows how to use if/then/else can't call themselves a logic programmer.
John
@Svend: This question never mentioned Prolog when I answered it. My comments have nothing to do with Prolog as the question was later altered to include it. @Jon: I'm being educated here about Prolog. :-) However, I still claim that if a person today said "I'm good with Prolog" that would mean something entirely different today than "I'm a good logic programmer". Prolog is just too non-mainstream and dated to just assume is what is being referred to in today's world.
Jaxidian
+8  A: 

The wikipedia entry explains it well: while on the surface it seems a redundant terms since all programming uses logic, in practice it's term for a well-defined paradigm, like, say, "functional programming" and "object-oriented programming". Specifically,

logic programming, in the narrower sense in which it is more commonly understood, is the use of logic as both a declarative and procedural representation language. It is based upon the fact that a backwards reasoning theorem-prover applied to declarative sentences in the form of implications:

If B1 and … and Bn then H

treats the implications as goal-reduction procedures:

to show/solve H, show/solve B1 and … and Bn.

The language Prolog (in some variant or other) is probably still the most popular logic programming language.

Alex Martelli
+1  A: 

I'd usually understand it to mean using prolog. Prolog allows you to define predicates, and truth values. The prolog interpreter can then derive further "truths", using standard logic rules. For example, each of the following lines establish a father_child and mother_children relationship between the first and the second parameter (the people mentioned are from the Simpsons).

member(X, [X|_]).
member(X, [_|T]) :- member(X,T).

mother_children(marge, [bart, lisa, maggie]).
mother_children(mona, [homer, jay]).

mother_child(X, Y) :- mother_children(X, C), member(Y, C).

father_child(homer, bart).
father_child(homer, lisa).
father_child(homer, maggie).
father_child(abe, homer).
father_child(abe, herb).
father_child(abe, abbie).

sibling(X, Y) :- parent_child(Z, X), parent_child(Z, Y).

parent_child(X, Y) :- father_child(X, Y).
parent_child(X, Y) :- mother_child(X, Y).

If you fire this program into a prolog interpreter, and then ask it sibling(X,Y), it will return to you all the pairs of siblings that exist. What's interesting is that we never explicit say that say, Bart is a sibling to Lisa. We just define father and mother relationships, but by defining further rules, prolog uses normal rules to derive what names fullfill the sibling rule.

Prolog was more popular in the 80s, in various AI systems and the like. It's a bit out of fashion these days (not that you'd know in universities, where it's still hot shit).

Svend