It's time again for Google Advent of Code 2021. This year I will try to do as many of the exercises as is possible but the focus will be different. Instead of pushing myself to get to the solution, which often meant sub-optimal code, I will instead try to learn the patterns beneath each exercises, in effect the general class of software problem that is being solved.

## Inspiration

I found Peter Norvig's solutions to the Advent of Code 2021 to be very elegant. So for 2021 I will use his pytudes as a base for developing the solutions. Norvig pytudes are basically a collection of terse functions that can be combined to solve each problem, many of which involve finding the *first *of something or to *quantify* something.

## Day 1

Now that we have the basis functions Day 1 was easy to solve.

```
def day1_1(nums):
"""How many measurements are larger than the previous measurement?"""
return quantify(map(lambda i: nums[i] > nums[i - 1],
range(1, len(nums))
)
)
def day1_2(nums):
"How many sliding window sums are greater than the previous"
return quantify(map(lambda i:
sum(nums[i - 3:i]) > sum(nums[i - 4: i - 1]),
range(4, len(nums) + 1)
)
)
```