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…
Introduction to logic programming with Prolog
51–60 of 93 posts
Re: Introduction to logic programming with Prolog
#52I find the section 5.3 from the paper "Out of the tar pit"[1] describes it very well: > It is for this reason that Prolog falls short of the ideals of logic programming. Specifically it is necessary to be concerned with the operational interpretation of the program whilst writing the axioms. I haven't heard of any approach that generalizes the goals of logic programming in a far better way. Is there any? (on specific…
What you're looking for is called answer set programming. It has pretty much replaced logic programming as a research focus, and a number of implementations exist.
Re: Introduction to logic programming with Prolog
#53Re: Introduction to logic programming with Prolog
#54Earlier quoted context omitted.
That is the best way to introduce computers to a kid: "let it do the hard work for you". Logo used to be very popular for kids here in the '80s. I learnt Logo when i was 7, then i "progressed" over the years to Basic, C, Pascal, C++, Java, C#, Python and now, after about 28 years, Lisp. And now I realize Logo is close to Lisp in many ways and a far more powerful language than some of the ones I "progressed" to.
It's always been interesting to me how Logo, a Lisp dialect, was so successful as a language for teaching children to program, but so many people still go around with the idea that Lisp is really hard to wrap your head around.
It deserves a blog post, but I'd say Lisp (at least Lisp in its mainstream Common Lisp incarnation) is easy to learn but extremely hard to master, since it allows many possibilities and paradigms, and because of the power of meta programming. So to master it, you would be familiarized with all the paradigms and you would know how to leverage meta programming, etc. Also, since it allows improving performance by going to low-level details (like observing the assembly output of your function), you would better know a bit of assembly/machine language if you want to be able to improve the performance of Lisp to approach (or equal) C code. So previous experience with low-level programming, at least with C, would be a good prerequisite.
But yes, using it for simple stuff is easy, and in fact, while I consider Python a great "first language to learn", sometimes I feel that Lisp isn't much difficult than Python, for the same tasks. Python is much easier to master, but then it is much more limited.
Re: Introduction to logic programming with Prolog
#55https://www.reddit.com/r/programming/comments/7hp2xw/introdu...
In modern Prolog systems, you would use more declarative features such as constraints to model combinatorial tasks like map coloring.
Make sure to check out modern Prolog features if you are interested in learning the language seriously!
Re: Introduction to logic programming with Prolog
#56I try to introduce my boy (12) in programming trough Scratch but still no big success. However, we solved recently two math homework exercises with Prolog (logic) and MetaPost (geometry) which caused some effect, so I'm thinking to deepen in that languages or may be switch to Logo as intermediate lisp like solution.
The child was encouraged to build general solutions to homework, and suddenly a lot of schoolwork with tedious arithmetic seems boring to the child.
Re: Introduction to logic programming with Prolog
#57When writing a Prolog program a while ago I stumbled across an old mailing list where someone posted the following joke. Q. "How many Prolog Programmers does it take to change a lightbulb?" A. No.
Re: Introduction to logic programming with Prolog
#58Re: Introduction to logic programming with Prolog
#59[1] https://bernardopires.com/2013/10/try-logic-programming-a-ge...
Re: Introduction to logic programming with Prolog
#60I agree with what Sylvain Soliman said about this on Reddit: It's a nice tutorial for the 80's parts of the language: https://www.reddit.com/r/programming/comments/7hp2xw/introdu... In modern Prolog systems, you would use more declarative features such as constraints to model combinatorial tasks like map coloring. Make sure to check out modern Prolog features if you are interested in learning the language seriously!