aboutsummaryrefslogtreecommitdiff
path: root/aoc-2022-dotnet/Day01
diff options
context:
space:
mode:
authorTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-02 23:14:21 +0100
committerTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-02 23:14:21 +0100
commitb40da532b3a3c98a5c6060f8addac0e1e581a3df (patch)
treefff6828eef1ace2d65eeb205ad38ce4e1285a679 /aoc-2022-dotnet/Day01
parent432a4dd0fb6cea783a4c60480f64e4724730d71f (diff)
downloadgleam_aoc2020-b40da532b3a3c98a5c6060f8addac0e1e581a3df.tar.gz
gleam_aoc2020-b40da532b3a3c98a5c6060f8addac0e1e581a3df.zip
Refactor day 2 solution
Diffstat (limited to 'aoc-2022-dotnet/Day01')
-rw-r--r--aoc-2022-dotnet/Day01/Program.fs8
1 files changed, 4 insertions, 4 deletions
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