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/Day02/Program.fs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'aoc-2022-dotnet/Day02/Program.fs') diff --git a/aoc-2022-dotnet/Day02/Program.fs b/aoc-2022-dotnet/Day02/Program.fs index 0546195..8568f9a 100644 --- a/aoc-2022-dotnet/Day02/Program.fs +++ b/aoc-2022-dotnet/Day02/Program.fs @@ -2,6 +2,7 @@ open System.IO open FSharpPlus +open Common type Move = | Rock @@ -36,11 +37,6 @@ type Strategy = | "Z" -> Z | s -> failwithf "Invalid strategy: %s" s -let splitToTuple sep str = - match Seq.toList <| String.split [ sep ] str with - | [ x; y ] -> x, y - | _ -> failwith "Invalid string format!" - let scoreRound (enemy, player) = let selectionScore = match player with @@ -70,7 +66,7 @@ let guide2 (enemy: Move) = let parseRound guide roundStr = let (enemy, strategy) = roundStr - |> splitToTuple " " + |> Util.splitStringToTuple " " |> mapItem1 Move.parse |> mapItem2 Strategy.parse -- cgit v1.2.3