Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(defnav every-nth [n]
(select* [this structure next-fn]
(next-fn (take-nth n structure)))
(transform* [this structure next-fn]
(let [xform (comp
(map-indexed
(fn [i x]
(if (zero? (mod i n))
(next-fn x)
x)))
(filter #(not (identical? % sp/NONE))))])
(if (vector? structure)
(into [] xform structure)
(sequence xform structure))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.