aboutsummaryrefslogtreecommitdiff
path: root/2022/puzzle-1.lisp
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-07-13 15:33:49 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-07-13 15:33:49 +0100
commit93b8ae46207cf29660fb3c21d34dc45ee872c670 (patch)
tree2d0d9262212808a61a8d7f6262e26a3d12d85c09 /2022/puzzle-1.lisp
parent70e2e26eb15680b0cecdd2ca54d9038c16982df1 (diff)
downloaddotfiles-93b8ae46207cf29660fb3c21d34dc45ee872c670.tar.gz
dotfiles-93b8ae46207cf29660fb3c21d34dc45ee872c670.tar.bz2
dotfiles-93b8ae46207cf29660fb3c21d34dc45ee872c670.zip
(2022)-deleted puzzle files
I think I did this by accident, check out https://git.aryadevchavali.com/advent-of-code/ for my actual advent of code runs.
Diffstat (limited to '2022/puzzle-1.lisp')
-rw-r--r--2022/puzzle-1.lisp26
1 files changed, 0 insertions, 26 deletions
diff --git a/2022/puzzle-1.lisp b/2022/puzzle-1.lisp
deleted file mode 100644
index 3a1510e..0000000
--- a/2022/puzzle-1.lisp
+++ /dev/null
@@ -1,26 +0,0 @@
-(defvar input (uiop:read-file-string "2022/1-input"))
-(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)))