Clojure – Lists first

Clojure lists first

In this guide, we will discuss Clojure Lists first. 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

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply