[Haskell-cafe] Code Review: Sudoku solver

Tom Schrijvers Tom.Schrijvers at cs.kuleuven.ac.be
Mon Apr 3 13:38:05 EDT 2006

> since I haven't factored out the constraint propagation into a
> general module, the core of my code is a lot longer than the Curry version 
> (about 60 additional lines, though I'm sure one could reduce that;-). the 
> only negative point I can find about the Curry example is that it isn't 
> obvious what tricks the FD-constraint solver is using

Curry does not have a constraint solver of its own. It 
simply delegates all constraints to the FD solver of SICStus Prolog. 
The all_different constraint subsumes the rules that you describe, 
depending on the consistency algorithm used. FD solvers implement general 
but efficient algorithms that are much more complex than a few simple 

for the SICStus FD all_different documentation.

> (ie., it would be nice 
> to have a concise language for expressing propagation techniques, and then 
> explicitly to apply a strategy to the declarative specification, instead of 
> the implicit, fixed strategy of the built-in solver).

CHR is meant as a highlevel language for expressing propagation. It 
(currently) does not include a strategy language though.



Tom Schrijvers

Department of Computer Science
K.U. Leuven
Celestijnenlaan 200A
B-3001 Heverlee

tel: +32 16 327544
e-mail: tom.schrijvers at cs.kuleuven.be

More information about the Haskell-Cafe mailing list