From 475d382b0baaa085910d6066d3a51943e777b147 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 22 Dec 2021 15:02:02 +0100 Subject: Pass the 4th day in AOC --- src/03.lisp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/03.lisp') 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)) -- cgit