Skip to content

Commit 22df155

Browse files
Minor improvements
1 parent 1e7760e commit 22df155

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

day9.el

+4-14
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@
1818
)
1919
(list inst op1 op2 op3)))
2020

21-
(defun permutations (list)
22-
"Return a list of all the permutations of the input."
23-
(if list
24-
(mapcan
25-
(lambda (e)
26-
(mapcar
27-
(lambda (perm) (cons e perm))
28-
(permutations (remove e list))))
29-
list)
30-
'(())))
31-
3221
;; an amplifier is
3322
;; - a program
3423
;; - a program counter
@@ -52,9 +41,10 @@
5241
(defun prog-set-output (raw-addr val mode)
5342
;; (print (concat "prog-set-output: " (prin1-to-string (list raw-addr val mode))))
5443
(let ((addr
55-
(if (= mode 0)
56-
(prog-get raw-addr)
57-
(+ (prog-get raw-addr) (prog-rel-base)))))
44+
(+ (prog-get raw-addr)
45+
(if (= mode 0)
46+
0
47+
(prog-rel-base)))))
5848
(puthash addr val program)))
5949
(defun prog-pc () (gethash 'pc amp))
6050
(defun prog-rel-base () (gethash 'rel-base amp))

0 commit comments

Comments
 (0)