Clojure – Sequences rest

Clojure sequences rest

In this guide, we will discuss Clojure Sequences rest. Returns the entire sequence except for the first element.

Syntax

Following is the syntax.

(rest seq1)

Parameters − ‘seq1’ is the sequence list of elements.

Return Value − Returns the entire sequence except for the first element.

Example

Following is an example of last in Clojure.

(ns clojure.examples.example
   (:gen-class))

;; This program displays Hello World
(defn Example []
   (def seq1 (seq [1 2 3 4 5]))
   (println (rest seq1)))
(Example)

Output

The above program produces the following output.

(2 3 4 5)

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply