Returns a possibly empty seq of the items after the first. Calls seq on its
argument.
;; A simple implementation using rest for recursing over a collection. Note that (seq coll) is used as the test.
(defn my-map [func coll]
(when-let [s (seq coll)]
(cons (func (first s))
(my-map func (rest s)))))
(def
^{:arglists '([coll])
:tag clojure.lang.ISeq
:doc "Returns a possibly empty seq of the items after the first. Calls seq on its
argument."
:added "1.0"}
rest (fn rest [x] (. clojure.lang.RT (more x))))
Comments top
1 comment(s) for rest.
rest is generally preferred over next. See the Clojure.org documentation on writing lazy functions.
Also, the topic is covered on StackOverflow.com: rest vs. next.