There's take-nth in core, but no drop-nth (which sounds like what you
need), so I wrote it:
(defn drop-nth [n coll]
(lazy-seq
(when-let [s (seq coll)]
(concat (take n s) (drop-nth n (next (drop n s)))))))
So, in your example:
(vec (drop-nth 2 [2 4 5 8 6 4]))
On Dec 1, 7:06 pm, Don <[email protected]> wrote:
> I have a vector [2 4 5 8 6 4]
>
> And I want to remove a value based on index. Specifically, I want to
> remove every third item.
>
> So my new vector would be [2 4 8 6]
>
> Thank you.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en