[Haskell-cafe] Norvig's Sudoku Solver in Haskell
daniel.is.fischer at web.de
Mon Aug 27 06:54:20 EDT 2007
Am Montag, 27. August 2007 11:24 schrieb Jon Harrop:
> On Monday 27 August 2007 09:09:17 manu wrote:
> > Daniel Fischer's modifications to my original program lead to a 400 %
> > speed boost !!!
> > (It now runs in 22 seconds on my machine)
> > He avoided unecessary calls to 'length', uses Array instead of Map,
> > refactored 'search' function (details below)
> > I've put up his version on hpaste : http://hpaste.org/2452#a1
> You shouldn't have any problem writing a purely functional solver that is
> faster and much shorter than Norvig's Python without having to use arrays.
Probably not, but what's wrong with using arrays (here and in general)?
Here I find arrays very natural, after all a grid has a fixed set of indices.
And as they have a much faster lookup than maps (not to mention lists), what
do you gain by avoiding them?
> The following purely functional OCaml solver is faster than Norvig's, for
> example, and uses lists, tuples and maps:
Since I don't speak OCaml, could you translate it to haskell?
More information about the Haskell-Cafe