diff --git a/2025/src/day09.clj b/2025/src/day09.clj index 3a31edf..023eb79 100644 --- a/2025/src/day09.clj +++ b/2025/src/day09.clj @@ -38,14 +38,13 @@ ;; part 2 (->> largest-squares (filter (fn [[a b]] - (let [segments (filter (fn [[seg-a seg-b]] (and (not= a seg-a) - (not= a seg-b) - (not= b seg-a) - (not= b seg-b))) + (let [segments (filter (fn overlapping? [[seg-a seg-b]] + (and (not= a seg-a) (not= a seg-b) + (not= b seg-a) (not= b seg-b))) ;; filter out segments that include points a or b line-segments) [[cx cy] [dx dy]] [a b]] (and (not (some #(intersect? [a b] %) segments)) - (not (some #(intersect? [[cx dy] [dx cy]] %) segments)))))) + (not (some #(intersect? [[cx dy] [dx cy]] %) segments)))))) ;; check reverse diaganol too (sort-by (partial apply area)) last (apply area))