Skip to content

Instantly share code, notes, and snippets.

# Part 1 solution
import gamla
with open(filename, "r") as f:
result = gamla.pipe(
f.readlines(),
gamla.map(str.strip),
gamla.map(gamla.split_text(" ")),
gamla.bifurcate(
gamla.filter(gamla.inside("forward")),
# A solution to both parts of AoC challenge day 1.
import gamla
PART = 1
with open(filename, "r") as f:
result = gamla.pipe(
f.readlines(),
gamla.map(int),
gamla.sliding_window(1 if PART == 1 else 3),
gamla.map(sum),