aboutsummaryrefslogtreecommitdiff
path: root/aoc2023-other/day-18/day-18.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-18/day-18.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-18/day-18.rkt')
-rw-r--r--aoc2023-other/day-18/day-18.rkt12
1 files changed, 8 insertions, 4 deletions
diff --git a/aoc2023-other/day-18/day-18.rkt b/aoc2023-other/day-18/day-18.rkt
index c18a750..b589e41 100644
--- a/aoc2023-other/day-18/day-18.rkt
+++ b/aoc2023-other/day-18/day-18.rkt
@@ -2,7 +2,7 @@
(require advent-of-code
threading)
-(struct coord (x y) #:transparent)
+(struct coord (x y))
(define input (~> (fetch-aoc-input (find-session) 2023 18 #:cache #true)))
@@ -25,11 +25,14 @@
([dig (in-list (string-split input "\n"))])
(define-values (dir dist) (parser dig))
(define next-coord (go-to-next-coord current-coord dir dist))
- (values (+ area (triangle-area current-coord next-coord)) (+ perimeter dist) next-coord)))
+ (values (+ area (triangle-area current-coord next-coord))
+ (+ perimeter dist) next-coord)))
;; part 1
(define (parse-front dig)
- (match-define (regexp #rx"(.) (.*) \\((.*)\\)" (list _ dir (app string->number dist) _hex)) dig)
+ (match-define (regexp #rx"(.) (.*) \\((.*)\\)"
+ (list _ dir (app string->number dist) _hex))
+ dig)
(values dir dist))
(find-area-using parse-front)
@@ -37,7 +40,8 @@
;; part 2
(define (parse-hex dig)
- (match-define (regexp #rx".*\\(#(.....)(.)\\)" (list _ (app (curryr string->number 16) dist) dir))
+ (match-define (regexp #rx".*\\(#(.....)(.)\\)"
+ (list _ (app (curryr string->number 16) dist) dir))
dig)
(values dir dist))