From 25f7a077a4d13359a6953b4cfdaa44d80cd66ced Mon Sep 17 00:00:00 2001 From: Hunky Jimpjorps Date: Fri, 9 Dec 2022 01:17:17 -0500 Subject: day 9 complete --- 2022/day-09/day-09.rkt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to '2022') diff --git a/2022/day-09/day-09.rkt b/2022/day-09/day-09.rkt index c3090de..0390d2e 100644 --- a/2022/day-09/day-09.rkt +++ b/2022/day-09/day-09.rkt @@ -14,11 +14,12 @@ _))) (define (move-head p dir) - (match* (p dir) - [((posn x y) 'U) (posn x (add1 y))] - [((posn x y) 'D) (posn x (sub1 y))] - [((posn x y) 'R) (posn (add1 x) y)] - [((posn x y) 'L) (posn (sub1 x) y)])) + (match-define (posn x y) p) + (match dir + ['U (posn x (add1 y))] + ['D (posn x (sub1 y))] + ['R (posn (add1 x) y)] + ['L (posn (sub1 x) y)])) (define (avg n m) (/ (+ n m) 2)) -- cgit v1.2.3