day8: make part1 concise

master
Clyne 3 years ago
parent 85d2aae745
commit 17362b34cc

@ -1,28 +1,15 @@
(require '[clojure.string :as str]) (require '[clojure.string :as str])
(loop [sum 0] (->> (str/split-lines (slurp "./in"))
(let [line (read-line)] (map
(if (empty? line) (fn [line]
(println sum) (as-> line $
(recur (str/split $ #" ")
(+ (subvec $ 11 15)
sum (filter #(.contains [2 3 4 7] (count %)) $)
(reduce (count $)
#(let [c (count %2)] )))
(if (or (= 2 c) (= 3 c) (= 4 c) (= 7 c)) (apply +)
(inc %1) (println)
%1 )
)
)
0
(subvec
(mapv (comp str/join sort) (str/split line #" "))
11 15
)
)
)
)
)
)
)

Loading…
Cancel
Save