I like the threaded use of update here in part 1 - my method used a transient map and returned a persistent copy at the end:
(nsaoc.aoc2)(defnreduce-twos-threes"check the given frequency map n for twos or threes matches, and update
the memo map to indicate if the string has a match. Used for a reducer."[memon](let[t-memo(transientmemo)](if(some(fn[[kv]](=v2))n)(assoc!t-memo:twos(inc(:twost-memo))))(if(some(fn[[kv]](=v3))n)(assoc!t-memo:threes(inc(:threest-memo))))(persistent!t-memo)))(defnchecksum[input](let[sum-maps(mapfrequenciesinput)twos-threes(reducereduce-twos-threes{:twos0:threes0}sum-maps)](*(:twostwos-threes)(:threestwos-threes))))
I like the threaded use of
update
here in part 1 - my method used a transient map and returned a persistent copy at the end:Nice one. Is definitely faster than mine.