Sha256: 86c9b3d45d8c630cc4e9296df3d2ff6a53ddb0970608b4f7dd181aad6b3a9c62
Contents?: true
Size: 622 Bytes
Versions: 396
Compression:
Stored size: 622 Bytes
Contents
module ParallelLetterFrequency open System let merge x y = let folder acc key value = match Map.tryFind key acc with | Some z -> Map.add key (z + value) acc | None -> Map.add key value acc Map.fold folder x y let calculateFrequency text = text |> Seq.filter (Char.IsLetter) |> Seq.countBy (fun c -> Char.ToLower c) |> Map.ofSeq let asyncCalculateFrequency text = async { return calculateFrequency(text) } let frequency texts = texts |> Seq.map asyncCalculateFrequency |> Async.Parallel |> Async.RunSynchronously |> Seq.fold merge Map.empty
Version data entries
396 entries across 396 versions & 1 rubygems