4 ms·
Do you have a suggestion on where to / how to start learning Prolog beyond towers-of-hanoi? Prolog is basically the last language on my list of things I want t
by lynx23 2y ago
Do you have a suggestion on where to / how to start learning Prolog beyond towers-of-hanoi? Prolog is basically the last language on my list of things I want to look at, but whenever I tried, I failed to find anything practical to do/try.
- dbcurtis 2y agoTry a rules-based synthesis problem. Prolog style (put simplisticly) is to write down what is true about a solution, and turn the search engine loose. Prolog is still procedural, unfortunately, so practical Prolog requires understanding the search algorithm. A suggestion: produce the XY locations of the nails for a building-code-compliant nailing pattern for a panel of plywood roof sheathing. Allow different stud spacing and wind speed zones. This is a small toy problem but will channel your thought process toward something Prologgy.
- tonyarkles 2y agoI love this example so much. I used a similar kind of problem a year or so ago when playing with some kind of logic/linear programming/optimization system: given a set of shelves (width and length), find the set of guillotine cuts (cuts across the entire sheet) that minimizes how many sheets of plywood are needed. If I recall the general problem is actually in NP but by formulating it as a problem of finding a list of operations (new sheet, cut sheet X horizontally, cut sheet X vertically) the solver was able to come up with high quality solutions in seconds. I then took it and added a second level: once it has found a minimal number of sheets, minimize the number of cuts. Super handy little tool! Once I had the solver part figured out and added a little tweak for handling kerf, it was quite simple to have it spit out an SVG that showed all of the pieces and cuts. And now… I want to go find that code and play with it again. Super fun stuff outside of the daily grind.
- amock 2y agoI’ve enjoyed https://www.metalevel.at/prolog https://www.metalevel.at/prolog but I’m not a Prolog Programmer.
- lynx23 2y agoAh, thanks for the link! I know his YouTube channel, but somehow I never realized there is a webpage too!
- lordwarnut 2y agoI have been going through https://www.ic.unicamp.br/~meidanis/courses/mc336/2009s2/prolog/problemas/ https://www.ic.unicamp.br/~meidanis/courses/mc336/2009s2/pro... It starts out pretty easy but gets harder and requires more thought. It has different sections on things like list processing or graph problems.