From 466c59e52b1ebb99fa128b5b9533f9e363dbbe34 Mon Sep 17 00:00:00 2001 From: Jonathan Chan Date: Tue, 7 Dec 2021 22:26:26 -0800 Subject: [PATCH] Day 08: Use different deduction. --- src/08.rkt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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