aboutsummaryrefslogtreecommitdiff
path: root/aoc2023-other/day-11
diff options
context:
space:
mode:
authorHJ <thechairman@thechairman.info>2023-12-25 11:24:39 -0500
committerHJ <thechairman@thechairman.info>2023-12-25 11:24:39 -0500
commit40eb8465f7958ac056a3843d38234848b15464f7 (patch)
tree6a22b862107f219c6b1c354c4ac70792e9d41ce8 /aoc2023-other/day-11
parentf3dfb53b1d59febe1f3bac746150372362f313a9 (diff)
downloadgleam_aoc-40eb8465f7958ac056a3843d38234848b15464f7.tar.gz
gleam_aoc-40eb8465f7958ac056a3843d38234848b15464f7.zip
day 1-24 end-of-year style cleanup
Diffstat (limited to 'aoc2023-other/day-11')
-rw-r--r--aoc2023-other/day-11/day-11.rkt8
1 files changed, 6 insertions, 2 deletions
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)])