Skip to content

Instantly share code, notes, and snippets.

@jvranish
Created July 20, 2010 15:53
Show Gist options
  • Save jvranish/483148 to your computer and use it in GitHub Desktop.
Save jvranish/483148 to your computer and use it in GitHub Desktop.
module Main where
import System.Environment
l v = f (reverse v) - 1
where
f ([]) = 0
f (x:xs) = (nmap x + 1) + baseLen * f xs
nmap x = fromJust $ lookup x $ zip base [0..]
base = ['a'..'z']
baseLen = length base
main :: IO ()
main = do
(v:_) <- getArgs
print $ l v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment