什么是逻辑编程?和其他的有什么不同
今天我和其他朋友聊天,他说他有逻辑编程能力,所以我对此很好奇。
today i have talk with other friend ,he said he has logic programming skill , so I am very curious about that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
wikipedia 条目解释得很好:虽然从表面上看,它似乎是一个多余的术语,因为所有编程都使用逻辑,实际上它是一个定义良好的范例的术语,例如“函数式编程”和“面向对象的编程”。具体来说,
Prolog 语言(某些变体或其他形式)可能仍然是最流行的逻辑编程语言。
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,
The language
Prolog
(in some variant or other) is probably still the most popular logic programming language.我通常将其理解为使用序言。 Prolog 允许您定义谓词和真值。然后,序言解释器可以使用标准逻辑规则得出进一步的“事实”。例如,以下每一行在第一个参数和第二个参数之间建立了一个
father_child
和mother_children
关系(提到的人来自辛普森一家)。如果您将该程序启动到 prolog 解释器中,然后询问它
sibling(X,Y)
,它将返回给您所有存在的兄弟姐妹对。有趣的是,我们从来没有明确地说,巴特是丽莎的兄弟姐妹。我们只是定义了父亲和母亲的关系,但通过定义进一步的规则,prolog 使用普通规则来派生出满足兄弟姐妹规则的名字。Prolog在80年代更流行,在各种人工智能系统等中。如今它有点过时了(你在大学里可能不会知道,在那里它仍然很热门)。
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
andmother_children
relationship between the first and the second parameter (the people mentioned are from the Simpsons).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 thesibling
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).
我认为该语句的意思是“我可以编写
if
/then
/else
语句”。或者换句话说,我认为这句话的意思是“我无法使用任何真正的技术进行编程”。我不会留下深刻的印象。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.