sequence
?A sequence
is a data storage structure that holds a collection of data objects. In Clojure, it can be seen as a logical list. The seq
method is used to create a sequence.
first
method in Clojure sequence?The first
sequence method returns the first element of a sequence.
(first seqq)
seqq
: This represents the sequence
containing the element.
This method returns the first value of a sequence.
(ns clojure.examples.example(:gen-class))(defn firstt [](def seq1 (seq [1 2 8 9 1 0 6 8 2]))(println (first seq1)))(firstt)
firstt
.seq1
.first
method to get the first value of the seq1
.firstt
function. Observe that the output returned "1" as it is the first value of the seq1
sequence.