You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
329 B
Clojure

(require '[clojure.string :as str])
(def fish-init
(->> (read-line)
(#(str/split % #","))
(map #(Integer/parseInt %))
(vec)
)
)
(defn cycle-day [fish]
(flatten
(for [f (map dec fish)]
(if (neg? f) [6 8] f)
)
)
)
(println (count (nth (iterate cycle-day fish-init) 80)))