←back to thread

Clolog

(github.com)
258 points todsacerdoti | 1 comments | | HN request time: 0.205s | source
Show context
sterlind ◴[] No.43696088[source]
really happy to see something of a revival of interest for logic programming lately. it's an extremely powerful tool if you know when to reach for it.
replies(2): >>43696328 #>>43696926 #
MarkMarine ◴[] No.43696328[source]
When would you reach for it?
replies(3): >>43696697 #>>43696708 #>>43696837 #
iLemming ◴[] No.43696708[source]
Scheduling, e.g., course scheduling - allocating rooms, professors, time slots while satisfying constraints; Product configuration systems - helping customers select compatible options for complex products; Genealogical research - querying family relationships and ancestry; Static analysis tools for code - finding bugs or verifying properties without execution; Medical diagnosis systems - inferring conditions from symptoms based on medical knowledge; Travel planning - finding optimal routes with multiple constraints; Legal reasoning systems - determining applicability of laws to specific cases; Natural language interfaces - parsing questions and generating appropriate database queries; Hardware verification - proving correctness of circuit designs; Puzzle solvers - Sudoku, crosswords, logic puzzles;

Basically anything that excels when declarative specification of relationships is more natural than imperative algorithms.

replies(3): >>43697181 #>>43697768 #>>43703416 #
sethhochberg ◴[] No.43697181[source]
This all makes perfect sense. The gap I usually have - and I admit its probably something of a skill issue, I have relatively little formal CS background - is how these abstract declarations of rules are integrated into a product. The example code in projects like this is usually pretty dense and intangible.

Does anyone have good examples of open source codebases or reading material in this area? Lets imagine I have a set of complex business rules about the way a product can be configured and I want to use a logic programming language to enforce them, called from a web interface based on config data stored in a traditional relational database. Is that... a misunderstanding of how these things are to be used?

I've love a good book about how to bring tools and techniques for logical correctness into a Rails ecosystem... or similar language/framework for app dev. I love the promises many of logic languages make but can't rewrite existing applications in them wholesale and it seems like they're a poor fit for that anyways. How are people blending these worlds at large enterprises? Maybe the answer is that nobody really is yet, and thats what makes things like Clolog + Clojure so exciting?

replies(2): >>43697561 #>>43700773 #
drob518 ◴[] No.43700773[source]
There are lots of good Prolog books available, many from the 1980s now released freely in PDF form. I would suggest starting there. IMO, Prolog is definitely worth understanding, but I personally tend to desire a Prolog available as an embedded resource in another language. So, Clolog is great for Clojure programmers, of which I am one, for instance. I find that Prolog excels for certain types of programming, but while it’s Turing complete, and thus capable of doing anything any other language can do, it can get cumbersome for other types of programming. So, I like to think of logic programming similar to the way that I think of a SAT solver, something that I call out to in order to solve a problem, but then it returns the answer to the main program which presents that answer to the user using the host language.
replies(1): >>43703763 #
1. cess11 ◴[] No.43703763[source]
The classic books can be a bit rough on the newbie, I'd recommend slogging through Triska's site and trying stuff out in Scryer, SWI or Tau first.

https://www.metalevel.at/prolog