refactor day 3

This commit is contained in:
Max Headroom 2022-12-09 15:02:06 +01:00
parent 89def61212
commit f76dad98cf
2 changed files with 6 additions and 8 deletions

View file

@ -5,10 +5,10 @@ let
chopInHalf = s: let
len = stringLength s;
in {
a = substring 0 (len / 2) s;
b = substring (len / 2) len s;
};
in [
(substring 0 (len / 2) s)
(substring (len / 2) len s)
];
lowercasePrio = flip pipe [ strings.charToInt (flip sub 96) ];
@ -21,8 +21,8 @@ pipe input [
(splitStr "\n")
(map (flip pipe [
chopInHalf
(mapAttrs (const strings.stringToCharacters))
(unpackAttrsCall intersectLists)
(map strings.stringToCharacters)
(uncurry intersectLists)
head
prio
]))

View file

@ -19,7 +19,5 @@ let
elemAt
(get: f (get 0) (get 1))
];
unpackAttrsCall = f: attrs: f attrs.a attrs.b;
};
in nixpkgsLib.fix aocLib