Skip to content

Instantly share code, notes, and snippets.

@KennyMonster
Created December 6, 2020 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KennyMonster/ef878c0a789cebe2df3e572a11803f01 to your computer and use it in GitHub Desktop.
Save KennyMonster/ef878c0a789cebe2df3e572a11803f01 to your computer and use it in GitHub Desktop.
AOC 2020 Day 6
(ns day-6
(:require [clojure.string :as str]
[clojure.set :refer [union intersection]]))
(def data (-> (slurp "input/day_6.txt")
(str/split #"\n\n")))
(defn yes-count [s set-op]
(count (apply set-op (map set (str/split-lines s)))))
(comment
(reduce + (map #(yes-count % union) data))
(reduce + (map #(yes-count % intersection) data)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment