In this guide, we will discuss Clojure Vectors get. Returns the element at the index position in the vector.
Syntax
Following is the syntax.
(get vec index)
Parameters − ‘vec’ is the set of elements in the vector. ‘index’ is the element at the index position which needs to be returned.
Return Value − The value of the element at the index position.
Example
Following is an example of get in Clojure.
(ns clojure.examples.example (:gen-class)) (defn example [] (println (get (vector 3 2 1) 2)) (println (get (vector 3 2 1) 1))) (example)
Output
The above code produces the following output.
1 2
Next Topic : Click Here
Pingback: Clojure - Vectors nth | Adglob Infosystem Pvt Ltd
Pingback: Clojure - Vectors | Adglob Infosystem Pvt Ltd