Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;Write a function which drops every Nth item from a sequence.
- (defn f
- [some-seq rm-idx]
- (loop [x (- rm-idx 1)
- result []]
- (when (< x (count some-seq))
- (conj result x)
- (recur (+ x rm-idx) result))))
- (f [1 2 3 4 5 6 7 8] 3)
- ;;should return [1 2 4 5 7 8]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement