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, 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)