
14 Nov
2009
14 Nov
'09
1:53 p.m.
Hi Bulat: I believe Jeff's original idea was to show an example of a monad transformer stack and ASCII art output. On Sat, 14 Nov 2009 21:42:01 +0300, you wrote:
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] -- Regards, Casey