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-14/day-14.rkt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'aoc2023-other/day-14') diff --git a/aoc2023-other/day-14/day-14.rkt b/aoc2023-other/day-14/day-14.rkt index e90feba..d0b7cad 100644 --- a/aoc2023-other/day-14/day-14.rkt +++ b/aoc2023-other/day-14/day-14.rkt @@ -15,15 +15,21 @@ (~> col (chunks-by (curry equal? #\#)) (append-map (curryr sort char>?) _)))) (define (score board) - (for*/sum ([col (in-list board)] [(row n) (in-indexed (reverse col))] #:when (equal? row #\O)) + (for*/sum ([col (in-list board)] + [(row n) (in-indexed (reverse col))] + #:when (equal? row #\O)) (add1 n))) ;; part 1 -(~> input roll-boulders score) +(~> input + roll-boulders + score) ;; part 2 (define (rotate-board xss) - (~> xss (map reverse _) transpose)) + (~> xss + (map reverse _) + transpose)) (define (full-cycle board) (foldl (λ (_ acc) (~> acc roll-boulders rotate-board)) board (range 4))) -- cgit v1.2.3