无涯教程-Clojure - conj函数

63 阅读1分钟

返回一个新序列,其中" x"是添加到序列末尾的元素。

conj - 语法

以下是语法。

(conj seq x)

参数      -  " x"是需要添加到序列中的元素。 " seq"是元素的顺序列表。

返回值  -  具有附加元素的新序列。

conj - 示例

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

;; This program displays Hello Learnfk (defn Example [] (println (conj [1 2 3] 4))) (Example)

上面的程序产生以下输出。

(1 2 3 4)

参考链接

www.learnfk.com/clojure/clo…