Skip to content

Instantly share code, notes, and snippets.

@neanias
Forked from GeorgiHristov42/tutorial, pr. 2
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neanias/c3762be76e4e3199cf52 to your computer and use it in GitHub Desktop.
Save neanias/c3762be76e4e3199cf52 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment