diff options
author | Yann Herklotz <git@yannherklotz.com> | 2021-12-22 15:02:02 +0100 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2021-12-22 15:02:02 +0100 |
commit | 475d382b0baaa085910d6066d3a51943e777b147 (patch) | |
tree | 8d18ba97d5eb03e0e11ed799211359c4ecd7aa76 /src/03.lisp | |
parent | 771f9fdf08671b2673a7b19d7980f15f2288eb26 (diff) | |
download | aoc21-475d382b0baaa085910d6066d3a51943e777b147.tar.gz aoc21-475d382b0baaa085910d6066d3a51943e777b147.zip |
Pass the 4th day in AOC
Diffstat (limited to 'src/03.lisp')
-rw-r--r-- | src/03.lisp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/03.lisp b/src/03.lisp index a9cd314..2a4b2fa 100644 --- a/src/03.lisp +++ b/src/03.lisp @@ -10,11 +10,6 @@ (defun 03/parse-input (input-file) (03/parse-input-direct (get-file-lines input-file))) -;; Loops through two item windows on input and counts each time the first is less than the second -(defun 03/partial (func &rest args1) - (lambda (&rest args2) - (apply func (append args1 args2)))) - (defun 03/is-more (h l) (mapcar (lambda (x) (if (< x h) 0 1)) l)) @@ -29,11 +24,11 @@ (defun 03/find-most-common (parsed-input) (let ((half-length (/ (list-length parsed-input) 2))) - (03/is-more half-length (apply (03/partial #'mapcar #'+) parsed-input)))) + (03/is-more half-length (apply (partial #'mapcar #'+) parsed-input)))) (defun 03/find-least-common (parsed-input) (let ((half-length (/ (list-length parsed-input) 2))) - (03/is-less half-length (apply (03/partial #'mapcar #'+) parsed-input)))) + (03/is-less half-length (apply (partial #'mapcar #'+) parsed-input)))) (defun 03/part-a (parsed-input) (let* ((l (03/find-most-common parsed-input)) |