From 1fc527b516e5c6a7ecc9928b003b2b18cd94d178 Mon Sep 17 00:00:00 2001 From: Edoardo La Greca Date: Mon, 15 Sep 2025 19:22:08 +0200 Subject: fix scoreString in third exercise --- lec07/Scrabble.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lec07/Scrabble.hs') 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 -- cgit v1.2.3