Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Becoming operational in Prolog quickly

My company has a project running in Prolog and I want to clarify few things about how to go about learning it. I know Prolog is different. It should not be learnt just like any other language.

Having said that, and considering the fact that I did not lay my hands on any Prolog book yet, Is there any book or online resource, where I can learn Prolog the way how we learn C/C++? What I mean is , just to be operational in C/C++, you just need to know the structure of the program, like main { } , loops, conditions, branches, and few functions that you can use to start writing basic programs in C/C++.

Just this way can I learn Prolog and is there any book that just gives me an idea how to Program in Prolog? (basics, loops, how to implement conditions, program structure, what's predicate? how to use it? how to define it? and so on...).

like image 924
JPro Avatar asked Jan 01 '10 20:01

JPro


People also ask

How can I be good at Prolog?

The best way to learn Prolog is to set aside all your previous programming experience. Actually thinking about C and C++ will make Prolog harder to learn and use. Try to adopt a beginner's mind and maybe an approach more like an algebraist than a programmer. Thank you for an interesting suggestion.

Is Prolog still used in 2021?

Yes, as mentioned in other answers, Prolog is actually used in IBM Watson. Prolog doesn't get much "hype" and "buzz" these days, but it is absolutely still used.

Does anyone use Prolog anymore?

Who's Actually Using Prolog? Trust me, Prolog is still being used — just not as extensively as some of the most commonly used languages in our industry, and there is a very good reason for that.

Is Prolog fast?

At the same time, Prolog is very fast and SICStus Prolog is one of the fastest and most stable Prolog systems, allows access to more than 256 MB of heap even on 32 bit systems (important for model checking), and is easy to interate with other programming languages (so that the GUI does not have to be developed in ...


3 Answers

If you're after a single book, I can highly recommend "The Art of Prolog":

Coming to Prolog from something like C/C++ isn't just a matter of learning a programming language. It's a wholly different way of thinking about programming.

Prolog is about asking the computer questions (or 'queries' if you like). Computation is almost a side-effect of the computer trying to answer your question. There is no meaningful equivalent to loops or conditionals because a prolog programmer wouldn't think in those terms.

A good Prolog program looks like a description of the problem that you're trying to solve decomposed into recursive cases and subproblems rather than lists of instructions organised into functions or classes.

The best way to learn Prolog is to set aside all your previous programming experience. Actually thinking about C and C++ will make Prolog harder to learn and use. Try to adopt a beginner's mind and maybe an approach more like an algebraist than a programmer.

like image 64
Dafydd Rees Avatar answered Oct 05 '22 22:10

Dafydd Rees


As a supplement to the Prolog tutorials and textbooks mentioned in the other answers, I would suggest having a quick look at this short document:

Prolog for Imperative Programmers

I think it's part of what you're looking for. It won't teach you Prolog, but it will help bridge the gap to understanding Prolog. It describes the basics of Prolog using terminology that experienced non-Prolog programmers would understand. For example, it shows you control structures in Prolog, i.e. sequence, selection and repetition. It does assume that you've already started learning Prolog, though.

It's good if you want to understand something new in terms of something you already know. However, armed with this knowledge/understanding, there is a risk that you could end up writing C code in Prolog syntax. Good luck!

like image 26
Nelson Avatar answered Oct 05 '22 23:10

Nelson


What's wrong with Learn Prolog Now, which is usually the top recommendation each time this kind of question gets asked?

It may not give you exactly the terminology you want -- I believe it doesn't even mention "predicate" (uses "Facts, Rules, and Queries" instead) or "loops" (it just shows how to use recursion instead) -- but getting the terminology right once the concepts are clear should be simple, fast, and easy, and "Learn Prolog Now" does seem to do a good job about making the concepts clear.

like image 26
Alex Martelli Avatar answered Oct 05 '22 22:10

Alex Martelli