Каковы преимущества использования Пролога по другим языкам? [закрытый]

Хорошо я заканчиваю тем, что писал модульные тесты в тесте MS. Перед каждым тестом сервис размещен опытной сборкой и разорван вниз впоследствии. Уверенный это не поблочное тестирование, таким образом, пуристы будут дрожать, но это действительно означает, что я могу запускать тесты так часто, как мне нравится.

8
задан MathieuF 1 May 2012 в 11:41
поделиться

4 ответа

Compared to what exactly? Prolog is really just the pre-eminent implementation of logic programming so if your question is really about a comparison of programming paradigms well that's really very broad indeed and you should look here.

If your question is more specifically about prolog vs the more commonly seen OO languages I would argue that you're really comparing apples to oranges - the "advantage" (such as it is) is just a different way of thinking about the world, and sometimes changing the way you ask a question provides a better tool for solving a problem.

5
ответ дан 5 December 2019 в 09:26
поделиться

Basically, if your program can be stated easily as declaritive formal logic statements, Prolog (or another language in that family) will give the fastest development time. If you use a good Prolog compiler, it will also give the best performance and reliability, because the engine will have had a lot of design and development effort.

Trying to implement this kind of thing in another language tends to be a mess. The cleanest and most general solution probably involves implementing your own unification engine. Even naive implementations aren't exactly trivial, the Warren Abstract Machine has a book or two written about it, and doing better will at the very least involve a fair bit of research, reading some headache-inducing papers.

Of course in the real world, key parts of your program may benefit from Prolog, but a lot of other stuff is better handled using another language. That's why a lot of Prolog compilers can interface with, e.g., C.

5
ответ дан 5 December 2019 в 09:26
поделиться

I'd say prolog works well for problems where a knowledge base forms an important part of the solution. Especially when the knowledge structure is suited to be encoded as logical rules.

For example, writing a natural language interpreter for a particular problem domain would require a lot of knowledge in that domain. Expert systems also fall within this knowledge driven category.

It's also a nice language to explore solutions to logical puzzles ;-)

1
ответ дан 5 December 2019 в 09:26
поделиться

Один из лучших моментов для использования Prolog - это когда у вас есть проблема, которую можно решить с помощью отслеживания с возвратом . И это тогда, когда у вас есть множество возможных решений проблемы, и, возможно, вы хотите приказать их включать / исключать в зависимости от некоторого контекста. Это предполагает большую двусмысленность ... как при обработке естественного языка.

Конечно, было бы намного аккуратнее записать все потенциальные ответы в виде предложений Пролога. Я думаю, что с императивным языком все, что вы действительно можете сделать, это написать гигантский (действительно гигантский) оператор CASE, что не слишком увлекательно.

2
ответ дан 5 December 2019 в 09:26
поделиться
Другие вопросы по тегам:

Похожие вопросы: