Sha256: 20779b1a49c0670bb2f8bf2354d8d0f89473044ef4b0d9ffde826704ed33b30a

Contents?: true

Size: 432 Bytes

Versions: 396

Compression:

Stored size: 432 Bytes

Contents

module ScrabbleScore

open System

let letterScores = 
    [("AEIOULNRST", 1); ("DG", 2); ("BCMP", 3); ("FHVWY", 4); ("K", 5); ("JX", 8); ("QZ", 10)] 
    |> List.map (fun (letters, score) -> letters |> Seq.map (fun letter -> (letter, score))) 
    |> Seq.concat 
    |> Map.ofSeq

let scoreLetter letter = defaultArg (Map.tryFind letter letterScores) 0

let score (word:string) = word.ToUpperInvariant() |> Seq.sumBy scoreLetter

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.97 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.96 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.95 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.94 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.93 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.92 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.91 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.90 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.89 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.88 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.87 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.86 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.85 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.84 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.83 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.82 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.81 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.80 tracks/fsharp/exercises/scrabble-score/Example.fs
trackler-2.2.1.79 tracks/fsharp/exercises/scrabble-score/Example.fs