From 967e964f453fc031816270b90d6eab38410769a3 Mon Sep 17 00:00:00 2001 From: Tomasz Chojnacki Date: Fri, 9 Dec 2022 19:31:24 +0100 Subject: Extract common functions to util module --- aoc-2022-dotnet/Day03/Program.fs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'aoc-2022-dotnet/Day03/Program.fs') diff --git a/aoc-2022-dotnet/Day03/Program.fs b/aoc-2022-dotnet/Day03/Program.fs index 153e639..512ef40 100644 --- a/aoc-2022-dotnet/Day03/Program.fs +++ b/aoc-2022-dotnet/Day03/Program.fs @@ -1,6 +1,7 @@ module Day03 open System.IO +open Common let priority item = if 'a' <= item && item <= 'z' then @@ -10,13 +11,9 @@ let priority item = else failwithf "Invalid item: %c" item -let cutInHalf xs = - let half = Seq.length xs / 2 - [ Seq.take half xs; Seq.skip half xs ] - let solution1 = Seq.sumBy ( - cutInHalf + Util.cutInHalf >> Seq.map Set >> Set.intersectMany >> Seq.exactlyOne -- cgit v1.2.3