diff options
Diffstat (limited to 'lec07')
| -rw-r--r-- | lec07/Scrabble.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lec07/Scrabble.hs b/lec07/Scrabble.hs index b0b34f9..278d405 100644 --- a/lec07/Scrabble.hs +++ b/lec07/Scrabble.hs @@ -1,6 +1,9 @@ module Scrabble where + +import Buffer import Data.Char import Data.List +import Data.Maybe -- Exercise 3 @@ -19,4 +22,4 @@ score c = Score $ fromMaybe 0 $ (!?) scores $ fromEnum (toUpper c) - fromEnum 'A where scores = [1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10] :: [Int] scoreString :: String -> Score -scoreString = foldl' <> mempty +scoreString = foldl' (\acc c -> acc <> (score c)) mempty |