News for hackers. Stuff that matters.
Re:Logic programming is overrated, at least for logic puzzle... by slaymaker1907 on Thursday June 01, 2023 @06:49PM (#36158512)
Of the logic programming languages, Prolog is actually pretty friendly when it comes to construction. You can easily force evaluation with an empty left clause, i.e. ":- thing1(x), thing2(y).", and Prolog gives you a lot of tools to control the current database with assert/retract (handy for memoization). Minikanren (which core.logic is based on) is much more restrictive and really wants things to be pure, though it does have the advantage of working as a library in an imperative language as a small runtime.
Re:Logic programming is overrated, at least for logic puzzle... by manasij7479 on Thursday June 01, 2023 @11:38PM (#36160660)
Neat, I wonder if this idea could be developed into a more refined programming experience where you you spend time in the imperative world by default and only express some iterations as logic puzzles to be solved like this.
Re:Logic programming is overrated, at least for logic puzzle... by BeautifulSynch on Sunday June 04, 2023 @04:07PM (#36189086)
I've actually seen this usage pattern in the practical usage of logic programming libraries. Common Lisp's Screamer [1], for instance, or Clojure's less-mature core.logic [2].

Though to be fair, both of these libraries are in Lisp languages, which inherently support the design pattern of slipping into/out-of DSLs.

[1] http://nikodemus.github.io/screamer/ [2] https://github.com/clojure/core.logic

Re:Logic programming is overrated, at least for logic puzzle... by slaymaker1907 on Tuesday June 06, 2023 @05:58PM (#36219620)
Minikanren/Microkanren (which is what core.logic is based off of) actually works really well as library in most languages. Nothing about it really requires macros to be easy to use, just higher order functions.