Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Prolog bad at?

Tags:

prolog

I was recently trying to learn about Prolog and it seems to map well to a lot of domains, but I was having trouble figuring out what it might be bad at.

So what is it bad at (besides things that need real-time/no-gc performance)?

like image 900
nosefouratyou Avatar asked Jun 23 '17 12:06

nosefouratyou


People also ask

Why Prolog is not popular?

It's not sufficient for a language to make the hard (or domain specific) things possible, it also needs to make all the easy things easy, and Prolog really does not. So the language either needs to be truly general purpose (and "more general-purpose than SQL" isn't sufficient) or easily integrated with other languages.

What is Prolog good at?

Prolog has been used largely for logic programming, and its applications include natural language understanding and expert systems such as MYCIN.

Why is Prolog so hard?

Prolog. Prolog is one of the first logic programming languages, now seeing adoption in artificial intelligence applications and natural language processing. It is hard to learn because: It is an unconventional language, its data structures are unlike other programming languages.


1 Answers

I agree with your general assessment that Prolog maps well to many domains. In my opinion, even more so than most other languages.

To give one of the few examples where it is bad at:

Prolog is decidedly bad at number crunching as it is currently understood. By this I mean many, many largely nonsensical calculations over floating point numbers, accumulating errors in ways that nobody can realistically understand or handle.

This is an area where Prolog implementations cannot compete as it is today, since all these calculations incur too much overhead by the way Prolog reasons about terms, and also because the nastiness of these calculations are generally abhorred in the logic programming community, where the focus is rather on correctness and convienence for users, and other number formats such as rational numbers are typically chosen if at all possible.

However, and I think that will become an important development of the future, once the extreme shortcomings of floating point numbers have become sufficiently widely understood and better formats (example: Unums etc.) have become sufficiently widely known and available, Prolog may become an increasingly important tool also in this area.

In his book, The End of Error, John Gustafson gives a beautiful analogy I often think about:

Many decades ago, it took 30 seconds to print a page. When printers become better, it still took 30 seconds to print a page. We did not spend all advancements of technology to print 5000 low-quality pages in 30 seconds, but rather improved the quality of the pages thousands of times.

I think number crunching will eventually go in the same direction: Use the increasingly available computing power to improve the quality of results, not the quantity.

like image 66
mat Avatar answered Oct 14 '22 05:10

mat