1 (asdf:load-system :adventofcode2020)
2 (in-package #:adventofcode2020)
4 (defun tree-collisions (slope tree-map)
5 (destructuring-bind (rise run) slope
6 (loop with terrain-width = (-> tree-map first length)
9 for terrain-line in tree-map
10 when (->> rise (mod j) (= 0))
11 counting (->> terrain-width
17 (let ((tree-map (list-from input)))
18 (part1 (tree-collisions '(1 3) tree-map))
19 (part2 (->> '((1 1) (1 3) (1 5) (1 7) (2 1))
20 (mapcar (fn* (tree-collisions _ tree-map)))
26 (test single-collision-check
29 (tree-collisions '(1 3) '("..##......."
42 (test multiple-collision-check
45 (mapcar (fn* (tree-collisions _ '("..##......."
56 '((1 1) (1 3) (1 5) (1 7) (2 1))))))