小编gec*_*chu的帖子

在Clojure中如何定义一个可以从其他命名空间访问的全局变量

在clojure中,声明全局变量的最佳方法是什么,需要在函数中更改其值,并且需要在其他命名空间中访问该全局变量

前任:

(ns ..main
 .....) 

(def global_variable nil)
..
(defn main ...

Change the value of global variable here 

) 

Another name space 

 (ns accessvariable ...) 

 (println (main/global_variable))
Run Code Online (Sandbox Code Playgroud)

做这个的最好方式是什么?

clojure

7
推荐指数
1
解决办法
3888
查看次数

标签 统计

clojure ×1