diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-06-26 08:35:43 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-06-26 08:36:53 +0100 |
commit | c0964cbb42710129a217e84bf7525f68f3fd670e (patch) | |
tree | faa7e762fb747342c44c9852eee84ec7e3f2860a /puzzle-1.lisp | |
parent | 29cacf2394a6d64f1ab3d5ba13a35f3beb08c3c7 (diff) | |
download | advent-of-code-c0964cbb42710129a217e84bf7525f68f3fd670e.tar.gz advent-of-code-c0964cbb42710129a217e84bf7525f68f3fd670e.tar.bz2 advent-of-code-c0964cbb42710129a217e84bf7525f68f3fd670e.zip |
(*->2022)~made it clear what advent of code I'm doing
Diffstat (limited to 'puzzle-1.lisp')
-rw-r--r-- | puzzle-1.lisp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/puzzle-1.lisp b/puzzle-1.lisp deleted file mode 100644 index 45d1921..0000000 --- a/puzzle-1.lisp +++ /dev/null @@ -1,26 +0,0 @@ -(defvar input (uiop:read-file-string "puzzle-1-input.txt")) -(defvar *sep (format nil "~%~%")) - -(defun get-lists (input) - (let ((pos (search *sep input))) - (with-input-from-string (s (subseq input 0 pos)) - (let ((converted - (loop - for line = (read-line s nil nil) - while line - collect (parse-integer line)))) - (if (null pos) - (list converted) - (cons converted - (get-lists (subseq input (+ pos 2))))))))) - -(defvar sums (sort (mapcar (lambda (lst) (reduce #'+ lst)) (get-lists input)) #'>)) - -;; First challenge -(format t "Top snacks: ~a" (car sums)) - -;; Second challenge -(let ((first (car sums)) - (second (car (cdr sums))) - (third (car (cdr (cdr sums))))) - (format t "~a,~a,~a:>~a" first second third (+ first second third))) |