+(ns adventofcode2019.day16
+ [:require [adventofcode2019.lib :refer :all]
+ [clojure.string :as str]])
+
+(defn parse-input [input]
+ (map (comp parse-int str) input))
+
+(defn phase [input]
+ (let [pattern (fn [n]
+ (->> [0 1 0 -1]
+ (mapcat (partial repeat n))
+ (cycle)
+ (rest)))
+ transform (fn [i n]
+ (->> (map * input (pattern (inc i)))
+ (reduce +)
+ (str)
+ (last)
+ (str)
+ (parse-int)))]
+ (map-indexed transform input)))
+
+(defn result-of [input]
+ (as-> (parse-input input) it
+ (iterate phase it)
+ (nth it 100)
+ (take 8 it)
+ (str/join it)))
+
+(defn day16 []
+ (let [[input] (get-list-from-file (input-file))]
+ (part1 (result-of input))
+ #_(part2)))