From 3fca5aebc32ba5bb13df780a7028bcd54b89a195 Mon Sep 17 00:00:00 2001 From: Tomasz Chojnacki Date: Sat, 17 Dec 2022 13:18:38 +0100 Subject: Submit part 1 of day 16 --- aoc-2022-dotnet/Common/Util.fs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'aoc-2022-dotnet/Common/Util.fs') 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) -- cgit v1.2.3