src/2020/days/day-06.lisp @ 6545da7f5f73
2021/17
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 17 Dec 2021 20:45:15 -0500 |
parents |
ff7c8ed35992 |
children |
(none) |
(advent:defpackage* :advent/2020/06)
(in-package :advent/2020/06)
(defun yes-counts (group)
(let ((answers (mapcar (rcurry #'coerce 'list) group)))
(cons (length (reduce #'union answers))
(length (reduce #'intersection answers)))))
(define-problem (2020 6) (data read-chunks) (7110 3628)
(let ((counts (mapcar #'yes-counts data)))
(values (summation counts :key #'car)
(summation counts :key #'cdr))))
#; Scratch --------------------------------------------------------------------