Hacker News new | past | comments | ask | show | jobs | submit login

Personally, I wasn't a fan of The Reasoned Schemer's format, https://io.livecode.ch/learn/webyrd/webmk worked better as my introduction.

See also: µKanren (http://webyrd.net/scheme-2013/papers/HemannMuKanren2013.pdf) and various ports like CL (https://github.com/rgc69/si-kanren) or Clojure (https://github.com/clojure/core.logic)




Here's another miniKanren-related livecode you might enjoy (both are thanks to Nada Amin's cool livecode.io tech!):

https://io.livecode.ch/learn/gregr/icfp2017-artifact-auas7pp


Thanks. Personally, I'd love to see more like https://alex-hhh.github.io/2021/08/fish-puzzle.html

When I was in university, the usual Prolog example was solving a game of Cluedo.


Is using miniKanren the only way to solve the fish-puzzle? If no, which language will be most ergonomic and accessible to solve it?


Pascal and Common Lisp were employed in the old benchmark assessment [0]. So just about anything should be able to.

But I'd expect many solver languages to be able to make it easier, like Prolog, datalog, mercury.

[0] http://cse.unl.edu/~choueiry/Documents/Hybrid-Prosser.pdf


I think there'll be all manner of constraint and constraint-logic programming approaches that'd be amenable. I wish I had a great answer for you as "the best".

IMO, these "zebra puzzle"/"einstein puzzle" style problems are like a "hello world" for many related techniques. What's more, there are many languages that combine several of these techniques together so that you can easily pick and choose where appropriate.

If you were just wanting to compare against another related style, answer-set programming is one thing that comes to mind.


Like most things in programming, there is no "only way" to solve something, and certainly no one language (or DSL) to solve anything. You could solve it programmatically in C writing your own backtracker or state enumerator and a validation function for the rules (or block of code if you are like an old coworker that liked 10k SLOC C functions).

miniKanren, Prolog, and others let you write the rules more concisely (almost always) and clearly (most of the time, not everyone will write clear code and clarity is subjective) than that, though.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: