aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2022/day-09/day-09.rkt11
1 files changed, 6 insertions, 5 deletions
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))