diff --git a/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs b/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs index d69c2439949..ac528ceb929 100644 --- a/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs +++ b/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs @@ -59,16 +59,10 @@ module internal Locals = /// Given a list of (key,value) /// Chunk into (key,values) where the values are keys of (key,value) with the same key. /// Complexity: this code is linear in (length kxs). - let rec chunkKeyValues kxs = - let rec loop kxs acc = - match kxs with - | [] -> List.rev acc - | (key, v)::rest -> accumulate key [v] rest acc - and accumulate k chunk rest acc = - match rest with - | (key, v)::rest when equal key k -> accumulate k (v::chunk) rest acc - | rest -> loop rest ((k, (List.rev chunk))::acc) - loop kxs [] + let chunkKeyValues allEntries = + allEntries + |> List.groupBy(fun (responseType, line) -> responseType) + |> List.map(fun (responseType, entries) -> (responseType, entries |> List.map(fun (_, line) -> line))) open Util