beginners 2025-11-25

say i have a set of vectors (in hiccup): [[:a "hello"] [:a "cruel"] [:a "world"]] what's the clojurey/FP way of inserting a new value between each element? [[:a "hello"] :space [:a "cruel"] :space [:a "world"]] in an imperative context, i would probably have some janky stuff with a counter inside an iterator. i imagine i could use split-at with for , but that feels a lot less elegant than it should be

interpose could do it

👍 2

user=> (into [] (interpose :space) [[:a "hello"] [:a "cruel"] [:a "world"]])
[[:a "hello"] :space [:a "cruel"] :space [:a "world"]]

🎯 1

ah thank you! slipped straight past my googling

👍 1