News for hackers. Stuff that matters.
Re:The Art of Prolog, Second Edition by ggggtez on Wednesday October 10, 2018 @04:41PM (#18188663)
As long as you know that Prolog is just a fancy wrapper around a brute force search, then sure.
Re:The Art of Prolog, Second Edition by segmondy on Wednesday October 10, 2018 @08:21PM (#18190091)
No 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.

Re:The Art of Prolog, Second Edition by tr352 on Wednesday October 10, 2018 @06:00PM (#18189300)
Uncalled 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.
Re:The Art of Prolog, Second Edition by tannhaeuser on Wednesday October 10, 2018 @06:31PM (#18189522)
Prolog 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.

Re:The Art of Prolog, Second Edition by newacctjhro on Wednesday October 10, 2018 @06:03PM (#18189329)
Resolution 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.ht...

Re:The Art of Prolog, Second Edition by jodrellblank on Wednesday October 10, 2018 @06:03PM (#18189324)
"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.

Re:The Art of Prolog, Second Edition by jodrellblank on Wednesday October 10, 2018 @11:30PM (#18190815)
Can'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... ) 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.