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 /day12/part1.clj | |
parent | 66ed0b9d27850dc653abc8baa75884f3de311bfa (diff) |
move 2021 days to folder; update README
Diffstat (limited to 'day12/part1.clj')
-rw-r--r-- | day12/part1.clj | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/day12/part1.clj b/day12/part1.clj deleted file mode 100644 index cdd4a43..0000000 --- a/day12/part1.clj +++ /dev/null @@ -1,27 +0,0 @@ -(require '[clojure.string :as str]) - -(def caves (->> (slurp "./in") - (str/split-lines) - (map #(str/split % #"-")) - (map (partial map str)) - (#(concat % (map reverse %))) - )) - -(defn get-caves-forward [klst] - (map #(cons (second %) klst) - (filter - #(or (< (int (first (second %))) 96) - (not-any? (partial = (second %)) klst)) - (filter #(= (first %) (first klst)) caves) - ))) - -(loop [lst (get-caves-forward ["start"]) ms '()] - (let [nxt (->> lst - (map get-caves-forward) - (apply concat)) - mtchs (concat ms (filter #(= (first %) "end") nxt)) - nxtlst (filter #(not= (first %) "end") nxt)] - (if (empty? nxtlst) - (println (count mtchs)) - (recur nxtlst mtchs)))) - |