Remove unnecessary code

This commit is contained in:
zuckerberg 2022-12-03 20:00:30 -07:00
parent fb7913ad3d
commit 0ca34d3bdc
3 changed files with 2 additions and 4 deletions

View File

@ -6,7 +6,7 @@ let
totalsPerElf = map sum elfCalories;
part1 = maxList totalsPerElf;
part2 = sum (topOfList 3 (sortList totalsPerElf));
part2 = sum (take 3 (sortList totalsPerElf));
in {
inherit part1;
inherit part2;

View File

@ -28,7 +28,7 @@ let
if b == 0 then mkLoss a
else if b == 1 then mkDraw a
else mkWin a;
makeBestMoves = m: map (pair: split pair (a: b: [a (bestMove a b)] )) m;
makeBestMoves = map (pair: split pair (a: b: [a (bestMove a b)] ));
in {
part1 = totalScore matches;
part2 = totalScore (makeBestMoves matches);

View File

@ -13,8 +13,6 @@ let
maxList = lib.foldr lib.max 0;
# Sorts a int list. Greatest value first
sortList = lib.sort (x: y: x > y);
# Returns the top cnt items of the list
topOfList = cnt: lib.take cnt;
# Cuts a list in half and returns the two parts in a list
cutInHalf = l: [(lib.take (lib.length l / 2) l) (lib.drop (lib.length l / 2) l)];
# Splits a list into a list of lists with length cnt