Clojure - Lists rest


Advertisements

Returns the remaining items in the list after the first item.

Syntax

Following is the syntax.

(rest lst)

Parameters − ‘lst’ is the list of items.

Return Value − A list of items with the first item removed.

Example

Following is an example of rest in Clojure.

(ns clojure.examples.example
   (:gen-class))
(defn example []
   (println (rest (list 1 2,3))))
(example)

Output

The above program produces the following output.

(2 3)
clojure_lists.htm
Advertisements