diff options
author | Hunky Jimpjorps <thechairman@thechairman.info> | 2022-12-09 01:17:17 -0500 |
---|---|---|
committer | Hunky Jimpjorps <thechairman@thechairman.info> | 2022-12-09 01:17:17 -0500 |
commit | 25f7a077a4d13359a6953b4cfdaa44d80cd66ced (patch) | |
tree | da468eeea28cf5335edea0b7288c303c6acedbfc /2022 | |
parent | c508424b7663208b10428b06f705401ed461de21 (diff) | |
download | gleam_aoc-25f7a077a4d13359a6953b4cfdaa44d80cd66ced.tar.gz gleam_aoc-25f7a077a4d13359a6953b4cfdaa44d80cd66ced.zip |
day 9 complete
Diffstat (limited to '2022')
-rw-r--r-- | 2022/day-09/day-09.rkt | 11 |
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)) |