diff --git a/src/08.rkt b/src/08.rkt index 75f3503..a6e4ae6 100644 --- a/src/08.rkt +++ b/src/08.rkt @@ -7,7 +7,7 @@ (for/list ([entry (problem-input 8)]) (match-let ([(list patterns outputs) (string-split entry " | ")]) (list (map string->list (string-words patterns)) - (map (∘ #{sort % charlist) (string-words outputs)))))) + (map #{sort (string->list %) char> input @@ -28,14 +28,14 @@ (set-first (set-subtract seven one))) (define bottom (set-first (set-subtract (apply set-intersect fives) four `(,top)))) + (define middle + (set-first (set-subtract (apply set-intersect fives) `(,top ,bottom)))) (define top-left - (set-first (set-subtract (apply set-intersect sixes) one `(,top ,bottom)))) + (set-first (set-subtract four one `(,middle)))) (define bottom-right (set-first (set-subtract (apply set-intersect sixes) `(,top ,bottom ,top-left)))) (define top-right (set-first (set-remove one bottom-right))) - (define middle - (set-first (set-subtract four one `(,top-left)))) (define bottom-left (set-first (set-subtract eight `(,top ,bottom ,top-left ,top-right ,bottom-right ,middle)))) (hash (sort one char