Guest User

Untitled

a guest
Jan 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {-lookUp :: Char -> [(Char, Char)] -> Char
  2. lookup c [] = []
  3. lookUp c  (:(zip xs ys) | c==x = snd (xs,ys) : lookUp c (xs,ys)
  4.                         | c/=x = lookUp c (xs,ys)
  5.                          
  6.  
  7. -- 5.
  8. encipher :: Int -> Char -> Char
  9. encipher n c = lookUp c (makeKey n)
  10. -}
  11. -- 6.
  12. normalize :: String -> String
  13. normalize (xs)  = [toUpper x | x <- xs, isAlpha x || isDigit x]
  14.  
  15. -- 7.
  16. encipherStr :: Int -> String -> String
  17. encipherStr = undefined
  18.  
  19. -- 8.
  20. reverseKey :: [(Char, Char)] -> [(Char, Char)]
  21. reverseKey (x,y):(xs,ys) = (y,x) : reverseKey [(xs,ys)]
Add Comment
Please, Sign In to add comment