• (rest coll)
Returns a possibly empty seq of the items after the first. Calls seq on its
argument.

5 Examples top

  • user=> (rest [1 2 3 4 5])
    (2 3 4 5)
    user=> (rest ["a" "b" "c" "d" "e"])
    ("b" "c" "d" "e")
  • user=> (rest '())
    ()
  • user=> (rest nil)
    ()
  • ;; 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)))))
  • user=>(rest '(1 2 3 4 5))
    '(2 3 4 5)
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:66 top

(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"
   :static true}  
 rest (fn ^:static rest [x] (. clojure.lang.RT (more x))))
Vars in clojure.core/rest:
Used in 0 other vars

Comments top

No comments for rest. Log in to add a comment.