AoC/2015/days/01/lisp.lisp

23 lines
501 B
Common Lisp

;; Day 1: Not Quite Lisp
;;
;; Part 1: What is the floor Santa takes ?
(defparameter balance 0)
(defun direction (char) (cond
((char= char #\()
+1)
((char= char #\))
-1)
))
(with-open-file (in "./data/input")
(do ((char (read-char in nil)
(read-char in nil)))
((null char))
(setf balance (+ balance (direction char)))))
(print balance)