1
Fork 0
mirror of https://github.com/RGBCube/AdventOfCode synced 2025-07-26 03:27:44 +00:00
This commit is contained in:
RGBCube 2023-12-02 18:46:30 +03:00
parent 3b843970e6
commit 6d86d57a77
No known key found for this signature in database

View file

@ -14,10 +14,7 @@ with builtins; with lib; rec {
nine = "9";
};
toDigit = maybeDigit: if digits ? "${maybeDigit}" then
digits.${maybeDigit}
else
maybeDigit;
toDigit = maybeDigit: digits.${maybeDigit} or maybeDigit;
allNeedles = flatten (mapAttrsToList (key: value: [ key (toString value) ]) digits);
allNeedlesReverse = map reverseString allNeedles;