diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2022-11-30 19:55:31 -0500 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2022-11-30 19:55:31 -0500 |
commit | 8d43e37df99f280377bed90284d6ac2428334804 (patch) | |
tree | 3a5042c9af29da52b4bac38fd78b3ccde77a1dbc /year2021/day6/part1.clj | |
parent | 66ed0b9d27850dc653abc8baa75884f3de311bfa (diff) |
move 2021 days to folder; update README
Diffstat (limited to 'year2021/day6/part1.clj')
-rw-r--r-- | year2021/day6/part1.clj | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/year2021/day6/part1.clj b/year2021/day6/part1.clj new file mode 100644 index 0000000..70293f7 --- /dev/null +++ b/year2021/day6/part1.clj @@ -0,0 +1,20 @@ +(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))) + |