Created
October 12, 2014 09:30
-
-
Save UnkindPartition/066d480394aa5351844f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- http://haskell98.blogspot.com/2014/10/blog-post_10.html | |
import Control.Monad | |
rotate n (x,y) = (n+1-y, x) | |
rotations n = take 4 $ iterate (rotate n .) id | |
solutions n = | |
let half = [ 1 .. n `div` 2 ] | |
quarter = liftM2 (,) half half | |
in mapM (\p -> rotations n `ap` [p]) quarter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment