A vector is a Clojure data structure that stores data in a sequentially indexed manner. The pop
method is used to return a new vector with all the elements of the vector except the last one.
(pop vec)
We pass one parameter to this method:
vec
: This represents the set of vector elements.
This method returns a new set of vector elements without the last element.
(ns clojure.examples.example(:gen-class))(defn popp [](println (pop (vector 3 2 1 4 5 6 7 8 0))))(popp)
Pop
.println
to print the new sets of vector elements. The pop
method removes the last element of the vector set which is 0
.popp
function.