Skip to content

Commit

Permalink
Changed functions names
Browse files Browse the repository at this point in the history
Getting ahead of myself here with the names.
  • Loading branch information
abraemer committed Dec 7, 2018
1 parent 70034b4 commit 79a527d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions day7.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

(in-package :advent-of-code-2018)

(defun day9-parse-line (line)
(defun day7-parse-line (line)
(list (char line 5) (char line 36)))

(defun day9-build ()
(defun day7-build ()
(let ((counts (make-hash-table :test 'equal))
(links (make-hash-table :test 'equal)))
(loop-line-by-line (puzzlepath "input7.txt")
Expand All @@ -15,7 +15,7 @@
:do (setf (gethash before counts) (gethash before counts 0))
:finally (return (list counts links)))))

(defun day9-next (counts)
(defun day7-next (counts)
(loop
:with next-key := nil
:for key :being :the :hash-keys :of counts
Expand All @@ -25,15 +25,15 @@
:do (setf next-key key)
:finally (return next-key)))

(defun day9-task-time (letter)
(defun day7-task-time (letter)
(- (char-code (char-upcase letter)) 4)); #\A -> 65 - 4 -> 61

(defun day9-shortest-worker (w1 w2)
(defun day7-shortest-worker (w1 w2)
(if (< (first w1) (first w2))
w1
w2))

(defun day9-solve (&optional (worker-count 5))
(defun day7-solve (&optional (worker-count 5))
(destructuring-bind (counts links) (day9-build)
(loop
:with seq := nil
Expand All @@ -54,7 +54,7 @@
:and :do (remhash next counts)
:finally (return (list (coerce (nreverse seq) 'string) time)))))

(defun day9 ()
(defun day7 ()
(destructuring-bind (seq time) (day9-solve 1)
(format t "With 1 worker the tasks are completed in this order: ~a and take ~a seconds.~%"
seq time))
Expand Down

0 comments on commit 79a527d

Please sign in to comment.