aboutsummaryrefslogtreecommitdiff
path: root/aoc-2022-dotnet/Common
diff options
context:
space:
mode:
authorTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-17 13:18:38 +0100
committerTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-17 13:18:38 +0100
commit3fca5aebc32ba5bb13df780a7028bcd54b89a195 (patch)
tree107e53caab2445a771a7eb7c02c901dd4e53ff23 /aoc-2022-dotnet/Common
parent689368eb3bbd9695ef2183ce03596a34be9292f5 (diff)
downloadgleam_aoc2020-3fca5aebc32ba5bb13df780a7028bcd54b89a195.tar.gz
gleam_aoc2020-3fca5aebc32ba5bb13df780a7028bcd54b89a195.zip
Submit part 1 of day 16
Diffstat (limited to 'aoc-2022-dotnet/Common')
-rw-r--r--aoc-2022-dotnet/Common/Util.fs8
1 files changed, 8 insertions, 0 deletions
diff --git a/aoc-2022-dotnet/Common/Util.fs b/aoc-2022-dotnet/Common/Util.fs
index 0086ac8..436e9a0 100644
--- a/aoc-2022-dotnet/Common/Util.fs
+++ b/aoc-2022-dotnet/Common/Util.fs
@@ -40,6 +40,14 @@ module Util =
let composition n f = List.replicate n f |> List.reduce (>>)
+ let notIn set element = not <| Set.contains element set
+
+ let maxOrZero seq =
+ if Seq.isEmpty seq then
+ 0
+ else
+ Seq.max seq
+
let rec insertSorted x =
function
| h :: t -> min h x :: (insertSorted (max h x) t)