1.3.0 permalink Arrow_down_16x16
  • (next coll)
Returns a seq of the items after the first. Calls seq on its
argument. If there are no more items, returns nil.

2 Examples top

  • user=> (next '(:alpha :bravo :charlie))
    (:bravo :charlie)
    
    user=> (next (next '(:one :two :three)))
    (:three)
    
    user=> (next (next (next '(:one :two :three))))
    nil
  • ;; next is used in the recursive call.  (This is a naive implementation for illustration only.  Using `rest` is usually preferred over `next`.)
    
    (defn my-map [func a-list]
      (when a-list
        (cons (func (first a-list))
              (my-map func (next a-list)))))
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:57 top

(def
 ^{:arglists '([coll])
   :tag clojure.lang.ISeq
   :doc "Returns a seq of the items after the first. Calls seq on its
  argument.  If there are no more items, returns nil."
   :added "1.0"
   :static true}  
 next (fn ^:static next [x] (. clojure.lang.RT (next x))))
Vars in clojure.core/next:
Used in 0 other vars

Comments top

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