function | since v0.0-927 | clojure.core/nthnext | Edit |
(nthnext coll n)
Returns the n
th next
of coll
.
Returns (seq coll)
when n
is 0.
Returns the nth next of coll, (seq coll) when n is 0.
(defn nthnext
[coll n]
(if (implements? IDrop coll)
(if (pos? n)
(-drop coll (Math/ceil n))
(seq coll))
(loop [n n xs (seq coll)]
(if (and xs (pos? n))
(recur (dec n) (next xs))
xs))))