euler-0.1.0.0

Safe HaskellSafe
LanguageHaskell2010

Euler.Util.WordScore

Description

The system of mapping letters to integers used by Euler problems 22 and 42.

Synopsis

Documentation

letterScore :: Char -> Int Source #

Maps the letters ['A'..'Z'] to [1..26], case-insensitively.

>>> map letterScore "AaBZ"
[1,1,2,26]

wordScore :: String -> Integer Source #

The sum of the letter scores in a string.

C   o    l    i   n
3 + 15 + 12 + 9 + 14
>>> wordScore "Colin"
53

wordScoreText :: Text -> Integer Source #

Same as wordScore, but for Text instead of String.