module ScrabbleScore open System let onePointLetter = [ 'A' 'E' 'I' 'O' 'U' 'L' 'N' 'R' 'S' 'T' ] let score word = word |> Seq.fold (fun a i -> let inset = List.contains (Char.ToUpper i) match Char.ToUpper i with | _ when inset onePointLetter -> a + 1 | _ when inset [ 'D'; 'G' ] -> a + 2 | _ when inset [ 'B'; 'C'; 'M'; 'P' ] -> a + 3 | _ when inset [ 'F'; 'H'; 'V'; 'W'; 'Y' ] -> a + 4 | _ when inset [ 'K' ] -> a + 5 | _ when inset [ 'J'; 'X' ] -> a + 8 | _ when inset [ 'Q'; 'Z' ] -> a + 10 | _ -> a + 0) 0