diff --git a/4/solution.nix b/4/solution.nix index 341aa90..620ecbf 100644 --- a/4/solution.nix +++ b/4/solution.nix @@ -4,9 +4,7 @@ let # read input input = readFile ./input; pairs = let - readRange = s: - let l = splitString "-" s; - in [ (toInt (head l)) (toInt (last l)) ]; + readRange = s: split (a: b: [ (toInt a) (toInt b) ]) (splitString "-" s); readPair = a: b: [ (readRange a) (readRange b) ]; in map (line: split readPair (splitString "," line))