Wednesday, January 17, 2018

Clojure: replicate elements in sequence

((fn [s n] (mapcat (fn [x] (repeat n x)) s)) [1 2 3] 2)
((1 1 2 2 3 3))