aboutsummaryrefslogtreecommitdiff
path: root/aoc-2022-dotnet/Common/Util.fs
diff options
context:
space:
mode:
Diffstat (limited to 'aoc-2022-dotnet/Common/Util.fs')
-rw-r--r--aoc-2022-dotnet/Common/Util.fs8
1 files changed, 3 insertions, 5 deletions
diff --git a/aoc-2022-dotnet/Common/Util.fs b/aoc-2022-dotnet/Common/Util.fs
index 436e9a0..acf89af 100644
--- a/aoc-2022-dotnet/Common/Util.fs
+++ b/aoc-2022-dotnet/Common/Util.fs
@@ -42,11 +42,9 @@ module Util =
let notIn set element = not <| Set.contains element set
- let maxOrZero seq =
- if Seq.isEmpty seq then
- 0
- else
- Seq.max seq
+ let updateMax key newValue map =
+ map
+ |> Map.add key (max newValue (map |> Map.tryFind key |> Option.defaultValue 0))
let rec insertSorted x =
function