From 40eb8465f7958ac056a3843d38234848b15464f7 Mon Sep 17 00:00:00 2001 From: HJ Date: Mon, 25 Dec 2023 11:24:39 -0500 Subject: day 1-24 end-of-year style cleanup --- aoc2023-other/day-11/day-11.rkt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'aoc2023-other/day-11') diff --git a/aoc2023-other/day-11/day-11.rkt b/aoc2023-other/day-11/day-11.rkt index 883ae11..dba617b 100644 --- a/aoc2023-other/day-11/day-11.rkt +++ b/aoc2023-other/day-11/day-11.rkt @@ -15,14 +15,18 @@ n)) (define (count-prior-empty-ranks rank empty-ranks) - (~> empty-ranks (takef (curryr < rank)) length)) + (~> empty-ranks + (takef (curryr < rank)) + length)) (define empty-rows (get-empty-ranks input)) (define empty-columns (get-empty-ranks (apply map list input))) ;; transpose (define (sum-of-star-distances in expand-by) (define stars - (for*/list ([(row x) (in-indexed in)] [(col y) (in-indexed row)] #:when (equal? col #\#)) + (for*/list ([(row x) (in-indexed in)] + [(col y) (in-indexed row)] + #:when (equal? col #\#)) (posn (+ x (* (sub1 expand-by) (count-prior-empty-ranks x empty-rows))) (+ y (* (sub1 expand-by) (count-prior-empty-ranks y empty-columns)))))) (for/sum ([star-pair (in-combinations stars 2)]) -- cgit v1.2.3