Initial commit

This commit is contained in:
2022-12-02 12:22:50 +01:00
commit 53da572ca6
5 changed files with 4867 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
(defun calories-per-elf (input)
(mapcar (lambda (x) (cl-ppcre:split "\\s+" x))
(cl-ppcre:split "\\n\\n" (uiop:read-file-string input))))
(defun parse-strings-and-sum (cals-per-elf)
(reduce '+ (mapcar #'parse-integer cals-per-elf)))
(defun part-one (input)
(apply #'max (mapcar #'parse-strings-and-sum
(calories-per-elf input))))
(defun part-two (input)
(reduce '+ (subseq (sort (mapcar #'parse-strings-and-sum (calories-per-elf input)) '>) 0 3)))
+2251
View File
File diff suppressed because it is too large Load Diff