~theothornhill/advent

a23dbb4d2c6d2c24c02f2539bda86bb332a6fcd4 — Theodor Thornhill 4 years ago 046e9db
Add optional streams for io
2 files changed, 5 insertions(+), 4 deletions(-)

M .gitignore
M intcode.lisp
M .gitignore => .gitignore +1 -0
@@ 1,1 1,2 @@
*.fasl
/day7-output.txt

M intcode.lisp => intcode.lisp +4 -4
@@ 128,13 128,13 @@
    (setf (set-mem z) (* (get-mem first-param-mode x)
                         (get-mem second-param-mode y)))))

(defun input ()
(defun input (&optional in)
  (with-io
    (setf (set-mem x) (parse-integer (read-line)))))
    (setf (set-mem x) (if in in (parse-integer (read-line))))))

(defun output ()
(defun output (&optional (stream t))
  (with-io
    (print (get-mem 0 x))))
    (format stream "~a" (get-mem 0 x))))

(defun jump-if-true ()
  (with-jump