This commit is contained in:
Max Headroom 2022-12-03 11:41:37 +01:00
parent bfc3d61f5d
commit 1a65daf518
4 changed files with 360 additions and 1 deletions

23
3/advanced.nix Normal file
View file

@ -0,0 +1,23 @@
with import ../lib;
let
input = fileContents ./input.txt;
lowercasePrio = flip pipe [ strings.charToInt (flip sub 96) ];
prio = c: let
p = lowercasePrio c;
in if p > 0 then p else p + 58;
in
pipe input [
(splitStr "\n")
(groupwise 3)
(map (flip pipe [
(map strings.stringToCharacters)
(l: foldl' intersectLists (head l) l)
head
prio
]))
sum
]

30
3/basic.nix Normal file
View file

@ -0,0 +1,30 @@
with import ../lib;
let
input = fileContents ./input.txt;
chopInHalf = s: let
len = stringLength s;
in {
a = substring 0 (len / 2) s;
b = substring (len / 2) len s;
};
lowercasePrio = flip pipe [ strings.charToInt (flip sub 96) ];
prio = c: let
p = lowercasePrio c;
in if p > 0 then p else p + 58;
in
pipe input [
(splitStr "\n")
(map (flip pipe [
chopInHalf
(mapAttrs (const strings.stringToCharacters))
(unpackAttrsCall intersectLists)
head
prio
]))
sum
]

300
3/input.txt Normal file
View file

@ -0,0 +1,300 @@
BccTFfTPTsffdDDqsq
lGGLQwFhDgWdqvhW
wbLNjGjlwLFrpSbllrHnHHRmmJVBmZJRRVcBTc
vvGLllBBLtllJnJFMZNjFcNG
bdhrhTgmhRrpLJMMNJgNffnf
qhRmTpzpzVzmTTbmVhWWWpVvDtsLVlwBVHvSsDCvvBDl
sLlhhthVRndBZzwBdV
PfmsPsqsGFqrSQpqBDDwpddDDM
mFjvSFrjPSvLJWvbRssN
gWnWQtMMDQbQvMDjjcwsvqcwsSSqZq
HzPJTtmtZJJsqfBJ
hCFPrNNPVNzFtQhdQMWRhhDd
sNhmsQZdNdsztNpHGCdjcBcwCvGvCv
brSlRfFFppHwfTpf
MbRlRpqMnqRpMhVtsQQQVWsM
HsdttdfHrHrwdhftMHMSDnJFwlQSgQZQZggZSW
LjCTqBCmmmTqgFQQFQjlnnDJ
GCTLBCmTBDBD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View file

@ -1,12 +1,18 @@
let
nixpkgsLib = import <nixpkgs/lib>;
aocLib = with nixpkgsLib; {
aocLib = with nixpkgsLib; rec {
groupwise = size: l: let
rest = drop size l;
in [ (take size l) ] ++ optionals (rest != []) (groupwise size rest);
splitStr = pattern: flip pipe [
(strings.split pattern)
(filter isString)
];
sum = foldl' add 0;
unpackAttrsCall = f: attrs: f attrs.a attrs.b;
};
in nixpkgsLib // aocLib