Initial commit
This commit is contained in:
@@ -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
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user