目录

vector-of

创建单个基本类型't'的新向量,其中't'是以下之一:int:long:float:double:byte:short:char或:boolean。 生成的向量通常符合向量的接口,但在内部存储未装箱的值。

语法 (Syntax)

以下是语法。

(vector-of t setofelements)

Parameters - 't'是向量元素应该是的类型。 'Setofelements'是向量中包含的元素集。

Return Value - 所需类型的元素的向量集。

例子 (Example)

以下是Clojure中vector-of的一个例子。

(ns clojure.examples.example
   (:require [clojure.set :as set])
   (:gen-class))
(defn example []
   (println (vector-of :int 1 2 3)))
(example)

输出 (Output)

上面的代码产生以下输出。

[1 2 3]
↑回到顶部↑
WIKI教程 @2018