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-18/day-18.rkt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'aoc2023-other/day-18') 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)) -- cgit v1.2.3