[Haskell-cafe] Where is a good place to place code like this, so if I may be so bold, people can learn from it?

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Nov 14 13:42:01 EST 2009


Hello Casey,

Saturday, November 14, 2009, 9:15:51 PM, you wrote:

> Where is a good place to place code like this, so if I may be so bold,
> people can learn from it?

the solution i've seen in 80's was:

main = print (solutions 8 8)

solutions n 0 = [[]]
solutions n k = [(i,k):xs | xs <- solutions n (k-1), i <- [1..n], check i k xs]

check i k xs = and [i1/=i && k1/=k && abs(i1-i)/=abs(k1-k)  |  (i1,k1) <- xs]


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list