4 ms·
If you find this kind of thing interesting, there is actually a branch of computer science called "logic programming" that is very similar, but actually useful
by humbledrone 11y ago
If you find this kind of thing interesting, there is actually a branch of computer science called "logic programming" that is very similar, but actually useful for practical applications (as it's not a joke).
A really simple example would be something like logpy [1]. You give it a set of variables, and a set of constraints, and it will try to efficiently solve for values that meet all the constraints.
A more professional-grade logic solver might be Clojure's core.logic [2], which has been used in many real-world applications. Compare the core.logic Sudoku solver [3] with the quantum version. They are similar, in that they each set the constraints for a solved board, but core.logic is vastly, vastly more efficient.
[1] https://github.com/logpy/logpy https://github.com/logpy/logpy
[2] https://github.com/swannodette/logic-tutorial https://github.com/swannodette/logic-tutorial
[3] https://gist.github.com/swannodette/3217582 https://gist.github.com/swannodette/3217582