Done day 18
[advent-of-code-21.git] / advent14 / Main.hs
index c6ade9729042e4b22a6b3b6a7bba2334d4f09dad..436f3d29327de997b4522fc653e87431e2067a4f 100644 (file)
@@ -1,4 +1,4 @@
--- Writeup at https://work.njae.me.uk/2021/12/13/advent-of-code-2021-day-13/
+-- Writeup at https://work.njae.me.uk/2021/12/16/advent-of-code-2021-day-14/
 
 import Data.Text ()
 import qualified Data.Text.IO as TIO
@@ -60,13 +60,11 @@ addSecond rules pair = c ++ [a]
   where a = pair!!1
         c = rules ! pair
 
--- countElements :: PolyPairs -> MS.MultiSet Char
 countElements :: PolyPairs -> M.Map Char Int
 countElements pairs = counts
   where firsts = MS.map (!!0) pairs
         seconds = MS.map (!!1) pairs
         elems = S.union (MS.toSet firsts) (MS.toSet seconds)
-        -- counts = MS.fromMap $ M.map ((`div` 2) . (+ 1)) $ MS.toMap $ MS.union firsts seconds
         counts = M.map ((`div` 2) . (+ 1)) $ MS.toMap $ MS.union firsts seconds