mirror of
https://github.com/Ajetski/advent-of-code.git
synced 2025-09-30 09:23:17 -09:00
apply concat > mapcat identity
This commit is contained in:
parent
bbd5f8818f
commit
57576bd5a4
@ -12,7 +12,7 @@
|
|||||||
(map-indexed (fn [col-idx char]
|
(map-indexed (fn [col-idx char]
|
||||||
[[row-idx col-idx] char])
|
[[row-idx col-idx] char])
|
||||||
line)))
|
line)))
|
||||||
(mapcat identity)
|
(apply concat)
|
||||||
(into {})))
|
(into {})))
|
||||||
|
|
||||||
;; produces a list of [row-idx col-idx "num"]
|
;; produces a list of [row-idx col-idx "num"]
|
||||||
@ -22,7 +22,7 @@
|
|||||||
(map-indexed (fn [row matches]
|
(map-indexed (fn [row matches]
|
||||||
(map #(vector row (:start %) (:group %))
|
(map #(vector row (:start %) (:group %))
|
||||||
matches)))
|
matches)))
|
||||||
(mapcat identity)))
|
(apply concat)))
|
||||||
|
|
||||||
(defn coords-to-check [row col num-str]
|
(defn coords-to-check [row col num-str]
|
||||||
(for [r [(dec row) row (inc row)]
|
(for [r [(dec row) row (inc row)]
|
||||||
@ -49,7 +49,7 @@
|
|||||||
(filter #(= \* (second %)))
|
(filter #(= \* (second %)))
|
||||||
(map #(vector % num-str)))))
|
(map #(vector % num-str)))))
|
||||||
(filter seq)
|
(filter seq)
|
||||||
(mapcat identity)
|
(apply concat)
|
||||||
(map (fn [[[coords] num-str]] [coords num-str]))))
|
(map (fn [[[coords] num-str]] [coords num-str]))))
|
||||||
|
|
||||||
;; gears is a set of [star-row-idx star-col-idx]
|
;; gears is a set of [star-row-idx star-col-idx]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user