[Haskell-cafe] Fun with Haskell, runST, MArray, and a few queens.

Glynn Clements glynn.clements at virgin.net
Fri Mar 5 05:01:45 EST 2004

David Sankel wrote:

> > Try this Queens.hs
> Thanks for the program, but how does one decipher the output?

The Nth item in each list is the column of the queen which is in row N
(or the row of the queen which is in column N; the transpose of a
valid solution must also be a valid solution).

If you prefer (row, column) pairs, use e.g.:

	main  = print $ map (zip [1..]) $ queens 10

Glynn Clements <glynn.clements at virgin.net>

More information about the Haskell-Cafe mailing list