5 ms·
As long as you know that Prolog is just a fancy wrapper around a brute force search, then sure.
by ggggtez 8y ago
As long as you know that Prolog is just a fancy wrapper around a brute force search, then sure.
- deleted 8y ago[deleted]
- tr352 8y agoUncalled for. Yes you can implement brute force search very conveniently in Prolog but there's obviously much more to it. You can dismiss ML in a similar way: It's fine as long as you know that it's just glorified curve fitting.
- jodrellblank 8y ago"Hey! I just found out - that tool isn't magic, it's JUST CODE!" What a con, I'll be sure to avoid anything like that in future.
- jodrellblank 8y agoCan't edit or delete at this point, so I'll note that I see this is against the "no snark" rule, and what I wanted to do was link to the c2.com wiki page "JustIsaDangerousWord" - a page that's now offline - about how a sentence gets better if you remove the word "just". "Prolog is just a brute force search" -> "Prolog is a brute force search" and then reference the Gary Larson comic ( https://pics.me.me/the-far-side-by-gary-larson-3-23-hey-wait-a-2526411.png https://pics.me.me/the-far-side-by-gary-larson-3-23-hey-wait... ) where the cow suddenly realises what they've been eating is /grass/. All libraries are "just" some code which does something so you don't have to. Even if Prolog is "just a brute force search", well in the same kind of way, regex is "just" a state machine brute-force matching against a string. It's still a useful tool.
- newacctjhro 8y agoResolution isn't really brute force search, in that it doesn't search all possible solutions at random; the search is directed by the programmer's rules. But yeah, it involves quite a lot of backtracking, that happens when the resolution engine needs to go back and try something different. When this is a problem you can sometimes use the cut rule http://www.cse.unsw.edu.au/~billw/dictionaries/prolog/cut.html http://www.cse.unsw.edu.au/~billw/dictionaries/prolog/cut.ht...
- tannhaeuser 8y agoProlog hits a sweet spot where you can start with built-in resolution and then use Prolog as implementation language for specific searches. Prolog should also be very popular with developers who like pattern matching and destructuring; it's pattern-matching by unification is, er, unmatched. Prolog is also excellent for DSLs, either usings it's built-in facility for defining new functors (unary or binary operators/keywords), or standard DCG recursive-descent parsers or more complex grammars. Prolog was designed for NLP, used for prototyping Erlang, and a major inspiration for Haskell after all.
- segmondy 8y agoNo it's not. Might as well say that SQL is a brute force search against your database. If you don't add indexes, you end up with slow queries. The art of efficient in prolog is understanding your database, facts, and your search space and how to trim it. If you need 3 items, search for 3 items only, don't search for all possible items then try to pick 3. If you can figure out when to cut your search, do so. For deterministic operations that you can meomize, do so. If your system supports tabling use it. Difference list is like the TCO of Prolog, the efficiency can be amazing. The difference in performance between an average programmer and a pro prolog programmer is usually much more than you will find in other languages.