1 (in-package #:adventofcode2020)
3 (defun tree-collisions (slope tree-map)
4 (destructuring-bind (rise run) slope
5 (loop with terrain-width = (-> tree-map first length)
8 for terrain-line in tree-map
9 when (->> rise (mod j) (= 0))
10 counting (->> terrain-width
16 (let ((tree-map (list-from input)))
17 (part1 (tree-collisions '(1 3) tree-map))
18 (part2 (->> '((1 1) (1 3) (1 5) (1 7) (2 1))
19 (mapcar (fn* (tree-collisions _ tree-map)))
25 (test single-collision-check
28 (tree-collisions '(1 3) '("..##......."
41 (test multiple-collision-check
44 (mapcar (fn* (tree-collisions _ '("..##......."
55 '((1 1) (1 3) (1 5) (1 7) (2 1))))))