Skip to main content

2021 - Day 1

🎄 Advent of Code in Zef 🎄​

https://adventofcode.com/2021/day/1

from zef.ops import *  

data = """
199
200
208
210
200
207
240
269
260
263
"""

result = (data
| split['\n']
| trim[''] # clean up artifacts
| map[int]
| sliding[2] # all consecutive pairs
| filter[unpack[less_than]]
| length # how many?
| collect # trigger evaluation
)

Similar in spirit to this solution in Elixir