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