Day 2: Dive!
Haskell: Part 1 (00:14:07, rank 8523), Part 2 (00:25:14, rank 9462)
Argh, I forgot how to use Parsec properly. I originally parsed the directions and kept them as strings, but refactored a bit after submission and parsed them as a Dir
sum type, although I didn't bother storing the numeric values with them since it was more convenient to pull them out of a tuple later.
I suspected I would mix up foldl
and foldr
's evaluation semantics and I did, so for a while I was processing the list in reverse. This didn't matter in part 1, but for part 2 it was multiplying by the wrong aim values. D'oh.