From cd80733367d8f4fa380eadeae9313501d7806e6e Mon Sep 17 00:00:00 2001 From: zuckerberg <5-zuckerberg@users.noreply.git.neet.dev> Date: Mon, 5 Dec 2022 13:07:44 -0700 Subject: [PATCH] Fomatting fix --- 4/solution.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/4/solution.nix b/4/solution.nix index d354647..661884c 100644 --- a/4/solution.nix +++ b/4/solution.nix @@ -3,12 +3,13 @@ with import ../util.nix; let # read input input = readFile ./input; - pairs = let - readRange = s: splitPair (a: b: [ (toInt a) (toInt b) ]) (splitString "-" s); - readPair = a: b: [ (readRange a) (readRange b) ]; - in map - (line: splitPair readPair (splitString "," line)) - (splitString "\n" input); + pairs = + let + readRange = s: splitPair (a: b: [ (toInt a) (toInt b) ]) (splitString "-" s); + readPair = a: b: [ (readRange a) (readRange b) ]; + in map + (line: splitPair readPair (splitString "," line)) + (splitString "\n" input); # overlap functions partialOverlap = a1: a2: b1: b2: @@ -18,7 +19,7 @@ let # calc overlaps hasOverlap = overlapFunc: a: b: - splitPair (splitPair overlapFunc a) b || splitPair (splitPair overlapFunc b) a; + splitPair (splitPair overlapFunc a) b || splitPair (splitPair overlapFunc b) a; overlaps = overlapFunc: map boolToInt (map (splitPair (hasOverlap overlapFunc)) pairs); in { part1 = sum (overlaps completeOverlap);