I know even less about Picat than I do about Prolog, so I’m not sure how Hakan’s solution is so much faster than mine.
I’m guessing it’s partially due to the different lineages. Picat comes from the world of constaint solving, which is much narrower than generalized logic programming and is much more heavily optimized. Like I wouldn’t be too surprised if they put more work into speeding up the all_different predicate than most languages put into optimizing their standard library.
I’d love to post a LogicT implementation using Haskell but normal sudoku using LogicT is the final assignment for the “Functional & Logic Programming” class I’m teaching. Will have to wait a month or so, sadly!
Ben (or do you prefer Benjamin?), this is great! When I saw this article in my RSS reader I laughed, because when I saw the Miracle Sudoku video I had the same inclination, and spent about 30 minutes trying to do exactly this, before I acknowledged I was avoiding my job and put it down. Thanks for this, helped me find the bug in my attempt 😄
I’m guessing it’s partially due to the different lineages. Picat comes from the world of constaint solving, which is much narrower than generalized logic programming and is much more heavily optimized. Like I wouldn’t be too surprised if they put more work into speeding up the
all_different
predicate than most languages put into optimizing their standard library.I’d love to post a LogicT implementation using Haskell but normal sudoku using LogicT is the final assignment for the “Functional & Logic Programming” class I’m teaching. Will have to wait a month or so, sadly!
I presume this is the course? https://course-profiles.uq.edu.au/student_section_loader/section_1/106673 I’m definitely pushing my luck but is any of the material open to the general public?
Lectures and pracs are public:
https://gitlab.com/comp3400
Assessment isn’t public. We’ll see if we can make it public after the course is finished. Maybe, maybe not.
Ben (or do you prefer Benjamin?), this is great! When I saw this article in my RSS reader I laughed, because when I saw the Miracle Sudoku video I had the same inclination, and spent about 30 minutes trying to do exactly this, before I acknowledged I was avoiding my job and put it down. Thanks for this, helped me find the bug in my attempt 😄
Glad you liked it! I normally don’t finish these types of projects either, but had a bit of extra time due to the long weekend. :)