diff options
author | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2022-12-16 21:22:24 +0100 |
---|---|---|
committer | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2022-12-16 21:22:24 +0100 |
commit | 689368eb3bbd9695ef2183ce03596a34be9292f5 (patch) | |
tree | 64475d757f95fe60fa3a06fabcfdd3d6ca5cd495 /aoc-2022-dotnet/Common/Util.fs | |
parent | 2f2684bb82970505414bc193ec4664d6dd6a3c64 (diff) | |
download | gleam_aoc2020-689368eb3bbd9695ef2183ce03596a34be9292f5.tar.gz gleam_aoc2020-689368eb3bbd9695ef2183ce03596a34be9292f5.zip |
Finish day 16
Diffstat (limited to 'aoc-2022-dotnet/Common/Util.fs')
-rw-r--r-- | aoc-2022-dotnet/Common/Util.fs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/aoc-2022-dotnet/Common/Util.fs b/aoc-2022-dotnet/Common/Util.fs index 8505f58..0086ac8 100644 --- a/aoc-2022-dotnet/Common/Util.fs +++ b/aoc-2022-dotnet/Common/Util.fs @@ -40,12 +40,12 @@ module Util = let composition n f = List.replicate n f |> List.reduce (>>) - let topN n xs = - let rec insertSorted x = - function - | h :: t -> min h x :: (insertSorted (max h x) t) - | _ -> [ x ] + let rec insertSorted x = + function + | h :: t -> min h x :: (insertSorted (max h x) t) + | [] -> [ x ] + let topN n xs = Seq.fold (fun acc x -> if List.length acc < n then |