diff options
author | HJ <thechairman@thechairman.info> | 2023-12-25 11:24:39 -0500 |
---|---|---|
committer | HJ <thechairman@thechairman.info> | 2023-12-25 11:24:39 -0500 |
commit | 40eb8465f7958ac056a3843d38234848b15464f7 (patch) | |
tree | 6a22b862107f219c6b1c354c4ac70792e9d41ce8 /aoc2023-other/day-14/day-14.rkt | |
parent | f3dfb53b1d59febe1f3bac746150372362f313a9 (diff) | |
download | gleam_aoc-40eb8465f7958ac056a3843d38234848b15464f7.tar.gz gleam_aoc-40eb8465f7958ac056a3843d38234848b15464f7.zip |
day 1-24 end-of-year style cleanup
Diffstat (limited to 'aoc2023-other/day-14/day-14.rkt')
-rw-r--r-- | aoc2023-other/day-14/day-14.rkt | 12 |
1 files changed, 9 insertions, 3 deletions
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))) |