Clojure-ns

提供:Dev Guides
移動先:案内検索

Clojure-ns

これは、新しいネームスペースを作成し、実行中のプログラムに関連付けるために使用されます。

構文

構文は次のとおりです。

(ns namespace-name)

パラメータ-「namespace-name」は、実行中のプログラムに関連付ける必要があるネームスペースです。

戻り値-なし。

以下はClojureのnsの例です。

(ns clojure.myown
   (:require [clojure.set :as set])
   (:gen-class))
(defn hello-world []
   (println *ns*))
(hello-world)

出力

上記のプログラムは、次の出力を生成します。

#object[clojure.lang.Namespace 0x50ad3bc1 clojure.myown]