diff options
Diffstat (limited to 'users/sterni/exercises/aoc/2022/nix.nix')
-rw-r--r-- | users/sterni/exercises/aoc/2022/nix.nix | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/users/sterni/exercises/aoc/2022/nix.nix b/users/sterni/exercises/aoc/2022/nix.nix deleted file mode 100644 index ca8bfc6e57df..000000000000 --- a/users/sterni/exercises/aoc/2022/nix.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ lib ? import <nixpkgs/lib> }: - -let - chomp = lib.removeSuffix "\n"; - lines = s: builtins.filter builtins.isString (builtins.split "\n" (chomp s)); - sum = builtins.foldl' builtins.add 0; - - day01 = - let - input = - builtins.map - (elf: - sum (builtins.map builtins.fromJSON (lines elf)) - ) - ( - builtins.filter builtins.isString ( - builtins.split "\n\n" (builtins.readFile ./01/input) - ) - ); - in - { - "1" = builtins.foldl' lib.max (-1) input; - "2" = sum (lib.sublist 0 3 (lib.sort (a: b: a >= b) input)); - }; - -in - -{ - inherit day01; -} |