aboutsummaryrefslogtreecommitdiff
path: root/2021/day8/08a.clj
blob: dc261e553f4a0dca13c714ecc37294c7f8c000c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
(ns day-8)

(require '[clojure.string :as str])

(def input (as-> (slurp "./input") x
              (str/split x #"\n")
              (map (fn [l]
                     (map (fn [p] (str/split (str/trim p) #" ")) (str/split l #"\|"))) x)))

(def onlyOutputs (flatten (map second input)))
(def knownDigits (filter (fn [xs] (contains? (set '(2 4 3 7)) (count xs))) onlyOutputs))
(println (count knownDigits))