Clojure - list*



Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence.

Syntax

Following is the syntax.

(list* listitems [lst])

Parameters − ‘listitems’ is the new list items which need to be appended. ‘lst’ is the list to which the items need to be appended to.

Return Value − The new list with the appended list items.

Example

Following is an example of list* in Clojure.

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

Output

The above program produces the following output.

(1 2 3)
clojure_lists.htm
Advertisements