Guest User

Untitled

a guest
Jan 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- 4.
  2. lookUp :: Char -> [(Char, Char)] -> Char
  3. lookup c [] = []
  4. lookUp c  (x,y):(xs,ys) | c==x = y : lookUp c (xs,ys)
  5.                         | c/=x = lookUp c (xs,ys)
  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