Clojure - Lists first


Advertisements

This function returns the first item in the list.

Syntax

Following is the syntax.

(first lst)

Parameters − ‘lst’ is the list of items.

Return Value − The first value from the list.

Example

Following is an example of first in Clojure.

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

Output

The above program produces the following output.

1
clojure_lists.htm
Advertisements