Clojure-vectorof
提供:Dev Guides
Clojure-ベクトルの
単一のプリミティブ型「t」の新しいベクトルを作成します。「t」は:int:long:float:double:byte:short:charまたは:booleanのいずれかです。 結果のベクトルは、一般的にベクトルのインターフェースに準拠しますが、値は内部でボックス化されて保存されます。
構文
構文は次のとおりです。
(vector-of t setofelements)
パラメータ-'t’は、ベクトル要素のタイプです。 「Setofelements」は、ベクターに含まれる要素のセットです。
戻り値-必要なタイプの要素のベクトルセット。
例
Clojureのvector-ofの例を次に示します。
(ns clojure.examples.example
(:require [clojure.set :as set])
(:gen-class))
(defn example []
(println (vector-of :int 1 2 3)))
(example)
出力
上記のコードは次の出力を生成します。
[1 2 3]