Live data from Hacker News

Introduction to logic programming with Prolog

matchilling.com

41–50 of 93 posts

Re: Introduction to logic programming with Prolog

#41

I've seen a few contalks about logic programming, read a few articles, and aside from the intellectual curiosity in itself I can see that it is very elegant in certain circumstances (although I lack the hands-on experience to feel what those circumstances are). Since doing a whole program in prolog isn't really practical for me, is there any way to use the logic programming paradigm in mainstream programming language…

>Since doing a whole program in prolog isn't really practical for me, is there any way to use the logic programming paradigm in mainstream programming languages to deal with specific problems that fit it?

Yes, for example is easy to embed Prolog code in Common Lisp by using a suitable library. For example the LispWorks implementation includes a full Prolog package. Example:

https://news.ycombinator.com/item?id=12251046

With this, you can use the logic paradigm within the same project, along with the other paradigms supported by Common Lisp: Procedural, functional, meta, imperative, dsl-based and OOP.

Racket should also allow very easy mixing of Prolog source with the rest of the project, since Racket was designed to support different languages at once.

Re: Introduction to logic programming with Prolog

#42
Is anyone reading this aware of any work on logic programming in the large as in efforts that are harnessing the fact that answerset programming avoids committed choice and so enables us to write reliable tractable programs, but aims to make that possible in teams or in distributed settings?

Re: Introduction to logic programming with Prolog

#43
post #42

Is anyone reading this aware of any work on logic programming in the large as in efforts that are harnessing the fact that answerset programming avoids committed choice and so enables us to write reliable tractable programs, but aims to make that possible in teams or in distributed settings?

Also work that tackles industry things like testing your logic programs?

Re: Introduction to logic programming with Prolog

#44
post #42

Is anyone reading this aware of any work on logic programming in the large as in efforts that are harnessing the fact that answerset programming avoids committed choice and so enables us to write reliable tractable programs, but aims to make that possible in teams or in distributed settings?

I haven't encountered anything across answer set programming in the large as you put it. It is still pretty academic and mainly used for solving puzzle and optimization problems.

Re: Introduction to logic programming with Prolog

#45
post #26

Earlier quoted context omitted.

I love Prolog, to the point of having taken part in the Portuguese university national logic championship back in the 90's. On our degree, we had three logic programming classes, starting from logic programming as pure math all the way to deep Prolog exercises.

I didn't know there were Logic championships using Prolog! P.S: Vocé é Portuguese, lisper e tambén fá de Prolog? You impress me more each day, pjmlp!

Obrigado, but actually it is due to quality of many of the teachers I had the opportunity to interact with during the 90's version of FCT/UNL. :)

Re: Introduction to logic programming with Prolog

#46

I've seen a few contalks about logic programming, read a few articles, and aside from the intellectual curiosity in itself I can see that it is very elegant in certain circumstances (although I lack the hands-on experience to feel what those circumstances are). Since doing a whole program in prolog isn't really practical for me, is there any way to use the logic programming paradigm in mainstream programming language…

SWI Prolog has a Java API. You can also use Datalog to get started. It's the non turing-complete version of Prolog. (You can not create facts in rules for example.) The best know Datalog Database is Datomic which you can use in the Java ecosystem but there is also pyDatalog for Python, which is really quite nice.

Re: Introduction to logic programming with Prolog

#47

I've seen a few contalks about logic programming, read a few articles, and aside from the intellectual curiosity in itself I can see that it is very elegant in certain circumstances (although I lack the hands-on experience to feel what those circumstances are). Since doing a whole program in prolog isn't really practical for me, is there any way to use the logic programming paradigm in mainstream programming language…

Racket has a Datalog too: https://docs.racket-lang.org/datalog/index.html You can mix languages in your Racket Programs as you like, very powerful.

Re: Introduction to logic programming with Prolog

#48

I've seen a few contalks about logic programming, read a few articles, and aside from the intellectual curiosity in itself I can see that it is very elegant in certain circumstances (although I lack the hands-on experience to feel what those circumstances are). Since doing a whole program in prolog isn't really practical for me, is there any way to use the logic programming paradigm in mainstream programming language…

If clojure is your thing there is core-logic https://github.com/clojure/core.logic

Re: Introduction to logic programming with Prolog

#49
post #4

I hated it in university and hate it until this very moment. I get what this language is doing and why it is great for special usecases. But I can absolutly can not read code written in Prolog. Staring at 3 lines of code and not knowing what the hell it does, gives me nightmares till today. You can write a quicksort in a few lines. You can traverse over a tree very easily. But understanding these few lines takes me m…

KIT?

You can learn prolog at more than one university in the world.
Post reply on HN