CLooker

Untitled

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