aboutsummaryrefslogtreecommitdiff
path: root/aoc-2022-dotnet/Common/Util.fs
diff options
context:
space:
mode:
authorTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-16 21:22:24 +0100
committerTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-16 21:22:24 +0100
commit689368eb3bbd9695ef2183ce03596a34be9292f5 (patch)
tree64475d757f95fe60fa3a06fabcfdd3d6ca5cd495 /aoc-2022-dotnet/Common/Util.fs
parent2f2684bb82970505414bc193ec4664d6dd6a3c64 (diff)
downloadgleam_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.fs10
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