Guest User

Untitled

a guest
May 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. module Main where
  2.  
  3. import System.Environment
  4.  
  5. l v = f (reverse v) - 1
  6. where
  7. f ([]) = 0
  8. f (x:xs) = (nmap x + 1) + baseLen * f xs
  9. nmap x = fromJust $ lookup x $ zip base [0..]
  10. base = ['a'..'z']
  11. baseLen = length base
  12.  
  13. main :: IO ()
  14. main = do
  15. (v:_) <- getArgs
  16.  
  17. print $ l v
Add Comment
Please, Sign In to add comment