summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdoardo La Greca2025-09-15 19:22:08 +0200
committerEdoardo La Greca2025-09-15 19:22:08 +0200
commit1fc527b516e5c6a7ecc9928b003b2b18cd94d178 (patch)
treef6706d99287131f96b6189dad86ffc48797063c1
parentbe5fe5353ab0554a999200d5cab593fdb8a2b5c4 (diff)
fix scoreString in third exercise
-rw-r--r--lec07/Scrabble.hs5
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