diff options
author | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2022-12-02 23:14:21 +0100 |
---|---|---|
committer | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2022-12-02 23:14:21 +0100 |
commit | b40da532b3a3c98a5c6060f8addac0e1e581a3df (patch) | |
tree | fff6828eef1ace2d65eeb205ad38ce4e1285a679 /aoc-2022-dotnet/Day01 | |
parent | 432a4dd0fb6cea783a4c60480f64e4724730d71f (diff) | |
download | gleam_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.fs | 8 |
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 |