aboutsummaryrefslogtreecommitdiff
path: root/aoc-2022-dotnet/Common/Util.fs
diff options
context:
space:
mode:
authorTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-17 21:14:53 +0100
committerTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-17 21:14:53 +0100
commita8c844a12fa2d91410fda7b37f08c58f5be34ed9 (patch)
tree1cb20c421bbd4b8394875aae8036894b4342d52a /aoc-2022-dotnet/Common/Util.fs
parent3fca5aebc32ba5bb13df780a7028bcd54b89a195 (diff)
downloadgleam_aoc2020-a8c844a12fa2d91410fda7b37f08c58f5be34ed9.tar.gz
gleam_aoc2020-a8c844a12fa2d91410fda7b37f08c58f5be34ed9.zip
Finish day 16
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