about summary refs log tree commit diff
path: root/day06.clj
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-12-07 19:19:52 +0100
committerLeah Neukirchen <leah@vuxu.org>2020-12-07 19:19:52 +0100
commitb59e223242a940b435a8badaffe0130836459a10 (patch)
tree5cf2d3102b459a23e149d60fb67d48b978ba10f0 /day06.clj
parentad5dd89ea90c3198d41a3b35250b4d8cd7af564d (diff)
downloadadventofcode2020-b59e223242a940b435a8badaffe0130836459a10.tar.gz
adventofcode2020-b59e223242a940b435a8badaffe0130836459a10.tar.xz
adventofcode2020-b59e223242a940b435a8badaffe0130836459a10.zip
day06
Diffstat (limited to 'day06.clj')
-rw-r--r--day06.clj17
1 files changed, 17 insertions, 0 deletions
diff --git a/day06.clj b/day06.clj
new file mode 100644
index 0000000..b7f8eca
--- /dev/null
+++ b/day06.clj
@@ -0,0 +1,17 @@
+(def data
+  (clojure.string/split (slurp "day06") #"\n\n"))
+
+(->> data
+     (map #(->> %
+                (remove #{\newline})
+                set
+                count))
+     (apply +)) ; => 6612
+
+(->> data
+     (map #(->> %
+                clojure.string/split-lines
+                (map set)
+                (reduce clojure.set/intersection)
+                count))
+     (apply +)) ; => 3268