You're viewing version 1.2.0 of pop. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16
  • (pop coll)
For a list or queue, returns a new list/queue without the first
item, for a vector, returns a new vector without the last item. If
the collection is empty, throws an exception. Note - not the same
as next/butlast.

1 Example top

  • user=> (peek [1 2 3])
    3
    user=> (pop [1 2 3])
    [1 2]
    user=> (peek '(1 2 3))
    1
    user=> (pop '(1 2 3))
    (2 3)
Log in to add / edit an example.

See Also top

  • 1
    clojure.core/peek

    For a list or queue, same as first, for a vector, same as, but much

  • 0
    clojure.core/rest

    Returns a possibly empty seq of the items after the first. Calls seq

  • 0
    clojure.core/conj

    conj[oin]. Returns a new collection with the xs 'added'. (conj ni

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:1135 top

(defn pop
  "For a list or queue, returns a new list/queue without the first
  item, for a vector, returns a new vector without the last item. If
  the collection is empty, throws an exception.  Note - not the same
  as next/butlast."
  {:added "1.0"}
  [coll] (. clojure.lang.RT (pop coll)))
Vars in clojure.core/pop: defn
Used in 1 other vars content-handler

Comments top

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