Skip to content

Instantly share code, notes, and snippets.

View neanias's full-sized avatar

William Mathewson neanias

View GitHub Profile
rotate :: Int -> [Char] -> [Char]
rotate k list | k >= 0, k <= length list = drop k list ++ take k list
| otherwise = []
makeKey :: Int -> [(Char,Char)]
makeKey n = zip xs ys
where
xs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" -- You can use ['A'..'Z']
ys = rotate n xs