aboutsummaryrefslogtreecommitdiff
path: root/2022
diff options
context:
space:
mode:
authorHunky Jimpjorps <thechairman@thechairman.info>2022-12-09 01:17:17 -0500
committerHunky Jimpjorps <thechairman@thechairman.info>2022-12-09 01:17:17 -0500
commit25f7a077a4d13359a6953b4cfdaa44d80cd66ced (patch)
treeda468eeea28cf5335edea0b7288c303c6acedbfc /2022
parentc508424b7663208b10428b06f705401ed461de21 (diff)
downloadgleam_aoc-25f7a077a4d13359a6953b4cfdaa44d80cd66ced.tar.gz
gleam_aoc-25f7a077a4d13359a6953b4cfdaa44d80cd66ced.zip
day 9 complete
Diffstat (limited to '2022')
-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))