Comment by crustycoder

11 hours ago

Or perhaps just use a language that's designed to solve those sorts of problems? In 14 lines of code.

https://www.swi-prolog.org/pldoc/man?section=clpfd-sudoku

Why not just

    blocks(Rows, Blocks), maplist(all_distinct, Blocks), maplist(label, Rows)