【问题标题】:Clojure list leiningen namespacesClojure 列出 leiningen 命名空间
【发布时间】:2016-06-04 15:11:18
【问题描述】:

Incanter,一个绘图/绘图工具,工作正常:

[incanter "1.5.6"] ; in project.clj
; in repl:
(do (use '(incanter core stats charts)) (view (histogram (sample-normal 1000))))

但是如何以编程方式列出来自 leiningen-dependencies 的命名空间? all-ns 不起作用:

; comes up empty UNTILL you (use 'incanter.charts):
(filterv #(.contains % "charts") (mapv str (all-ns)))

有没有办法做到这一点?

【问题讨论】:

    标签: reflection clojure leiningen


    【解决方案1】:

    (all-ns) 仅返回已加载的命名空间(直接或间接,例如通过使用 requireuse)。

    要搜索尚未加载的命名空间,您可以使用 tools.namespace 及其 clojure.tools.namespace.find 命名空间中的函数。

    【讨论】:

      猜你喜欢
      • 2015-09-16
      • 2011-08-31
      • 2012-10-10
      • 1970-01-01
      • 2011-04-15
      • 2021-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多