aboutsummaryrefslogtreecommitdiff
path: root/aoc2023-other/day-08/day-08.rkt
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-08/day-08.rkt
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-08/day-08.rkt')
-rw-r--r--aoc2023-other/day-08/day-08.rkt10
1 files changed, 7 insertions, 3 deletions
diff --git a/aoc2023-other/day-08/day-08.rkt b/aoc2023-other/day-08/day-08.rkt
index bc234b5..06daafa 100644
--- a/aoc2023-other/day-08/day-08.rkt
+++ b/aoc2023-other/day-08/day-08.rkt
@@ -16,7 +16,10 @@
[(list _ name left right) (values name (exits left right))])))
(define (to-next-node start end dirs maze)
- (for/fold ([current start] [acc 0] #:result acc) ([dir (in-cycle dirs)])
+ (for/fold ([current start]
+ [acc 0]
+ #:result acc)
+ ([dir (in-cycle dirs)])
#:break (string-suffix? current end)
(define node (hash-ref maze current))
(case dir
@@ -28,5 +31,6 @@
;; part 2
(for/lists (ns #:result (apply lcm ns))
- ([start (in-list (hash-keys maze))] #:when (string-suffix? start "A"))
- (to-next-node start "Z" directions maze))
+ ([start (in-list (hash-keys maze))]
+ #:when (string-suffix? start "A"))
+ (to-next-node start "Z" directions maze))