|
1 | 1 | (defpackage :aoc/2024/24 #.cl-user::*aoc-use*)
|
2 | 2 | (in-package :aoc/2024/24)
|
3 | 3 |
|
4 |
| -(declaim (optimize (debug 3))) |
5 |
| - |
| 4 | +#; |
6 | 5 | (defun parse-input (&optional (strings (uiop:read-file-lines #P"src/2024/day24.txt")))
|
7 | 6 | (destructuring-bind (connections initial-wires)
|
8 | 7 | (split-sequence:split-sequence "" strings :test 'equal)
|
9 | 8 | (list
|
10 | 9 | ;; values
|
11 |
| - (prog1-let (map (make-hash-table :test 'equal)) |
| 10 | + (prog1-let1 map (make-hash-table :test 'equal) |
12 | 11 | (dolist (s connections)
|
13 | 12 | (setf (gethash (subseq s 0 3) map)
|
14 | 13 | (parse-integer (subseq s 5)))))
|
15 | 14 | ;; inputs
|
16 |
| - (prog1-let (map (make-hash-table :test 'equal)) |
| 15 | + (prog1-let map (make-hash-table :test 'equal) |
17 | 16 | (dolist (s initial-wires)
|
18 | 17 | (destructuring-bind (in1 gate in2 _ output)
|
19 | 18 | (split-sequence:split-sequence #\Space s)
|
20 | 19 | (declare (ignore _))
|
21 | 20 | (setf (gethash in1 map) (list in1 gate in2 output)
|
22 | 21 | (gethash in2 map) (list in1 gate in2 output) ))))
|
23 | 22 | ;; outputs
|
24 |
| - (prog1-let (map (make-hash-table :test 'equal)) |
| 23 | + (prog1-let map (make-hash-table :test 'equal) |
25 | 24 | (dolist (s initial-wires)
|
26 | 25 | (destructuring-bind (in1 gate in2 _ output)
|
27 | 26 | (split-sequence:split-sequence #\Space s)
|
|
140 | 139 | (same-expansion? rand12 rand21)))))))))
|
141 | 140 |
|
142 | 141 | (defun swap (outputs gate1 gate2 gate3 gate4 gate5 gate6 gate7 gate8)
|
143 |
| - (prog1-let (copy (copy-hash-table outputs)) |
| 142 | + (prog1-let1 copy (copy-hash-table outputs) |
144 | 143 | (rotatef (gethash gate1 copy)
|
145 | 144 | (gethash gate2 copy))
|
146 | 145 | (rotatef (gethash gate3 copy)
|
|
0 commit comments