From b40da532b3a3c98a5c6060f8addac0e1e581a3df Mon Sep 17 00:00:00 2001 From: Tomasz Chojnacki Date: Fri, 2 Dec 2022 23:14:21 +0100 Subject: Refactor day 2 solution --- aoc-2022-dotnet/Day01/Program.fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'aoc-2022-dotnet/Day01') diff --git a/aoc-2022-dotnet/Day01/Program.fs b/aoc-2022-dotnet/Day01/Program.fs index 560e770..adcb20e 100644 --- a/aoc-2022-dotnet/Day01/Program.fs +++ b/aoc-2022-dotnet/Day01/Program.fs @@ -16,11 +16,11 @@ let topN n xs = | _ -> [ x ] Seq.fold - (fun acc elem -> + (fun acc x -> if List.length acc < n then - insertSorted elem acc - elif List.head acc < elem then - insertSorted elem (List.tail acc) + insertSorted x acc + elif List.head acc < x then + insertSorted x (List.tail acc) else acc) List.empty -- cgit v1.2.3