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

Casey Hawthorne caseyh at istar.ca
Sat Nov 14 13:53:38 EST 2009


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


More information about the Haskell-Cafe mailing list