From b063bce19a23def65b69e133d2a4a0e3bb858b90 Mon Sep 17 00:00:00 2001 From: Smaug123 Date: Mon, 4 Dec 2023 23:46:38 +0000 Subject: [PATCH] Add alternative --- .../AdventOfCode2023.FSharp.Lib/Day4.fs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.Lib/Day4.fs b/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.Lib/Day4.fs index 1f10a48..4a3f71b 100644 --- a/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.Lib/Day4.fs +++ b/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.Lib/Day4.fs @@ -1,16 +1,17 @@ namespace AdventOfCode2023 open System +open System.Globalization [] module Day4 = let inline parseByte (chars : ReadOnlySpan) : byte = - // Byte.Parse (chars, NumberStyles.None, NumberFormatInfo.InvariantInfo) - let mutable answer = 0uy - for c in chars do - answer <- answer * 10uy + (byte c - 48uy) - answer + Byte.Parse (chars, NumberStyles.None, NumberFormatInfo.InvariantInfo) + //let mutable answer = 0uy + //for c in chars do + // answer <- answer * 10uy + (byte c - 48uy) + //answer let part1 (s : string) = use lines = StringSplitEnumerator.make '\n' s