open:cons

cons

A cons is a sequence type which holds a value and a reference to another sequence.

7yg10il.jpg

2egryd4.jpg

uvojz2f.jpg

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

Output

(0 1 2 3)

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

;; This program displays Hello World
(defn Example []
   (println (cons 0 (seq [1 2 3]))))
(Example)

Output

(0 1 2 3)

  • open/cons.txt
  • Last modified: 2024/10/05 06:15
  • by 127.0.0.1