diff options
Diffstat (limited to '2022')
-rw-r--r-- | 2022/day-13/day-13.rkt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/2022/day-13/day-13.rkt b/2022/day-13/day-13.rkt index d4e3185..39435e9 100644 --- a/2022/day-13/day-13.rkt +++ b/2022/day-13/day-13.rkt @@ -10,11 +10,11 @@ (match* (xs ys) [('() (list* _)) #true] [((list* _) '()) #false] - [((list* a x-rest) (list* a y-rest)) (compare x-rest y-rest)] + [((list* _same x-rest) (list* _same y-rest)) (compare x-rest y-rest)] [((list* (? integer? x) _) (list* (? integer? y) _)) (< x y)] [((list* (? list? xs*) _) (list* (? list? ys*) _)) (compare xs* ys*)] - [((list* (? list?) _) (list* (? integer? y) y-rest)) (compare xs (cons (list y) y-rest))] - [((list* (? integer? x) x-rest) (list* (? list?) _)) (compare (cons (list x) x-rest) ys)])) + [(xs (list* (? integer? y) y-rest)) (compare xs (cons (list y) y-rest))] + [((list* (? integer? x) x-rest) ys) (compare (cons (list x) x-rest) ys)])) ;; part 1 (for/sum ([i (in-naturals 1)] [packet (in-slice 2 raw-packets)] #:when (apply compare packet)) i) |