本文介绍了如何导入整个包但在 Clojure 中排除一些包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想导入整个 weka.classifiers.functions 包但不想导入 RBFNetwork 类.

I want to import the entire weka.classifiers.functions package but dont want to import RBFNetwork class.

 (ns com.wekatest
 (:import  (weka.classifiers Classifier Evaluation)
           (weka.classifiers.functions)
           (weka.core Attribute FastVector Instance Instances)))

(weka.classifiers.functions) 不导入整个包.我该怎么做?

(weka.classifiers.functions) doesn't import the entire package. How do I do that?

推荐答案

Clojure 没有提供一种在未明确指定每个类的情况下导入 Java 包中的每个类的方法.在这里查看 Rich Hickey 对基本相同问题的回答:http://groups.google.com/group/clojure/browse_thread/thread/fa00a0ff4c264f9a

Clojure does not provide a way to import every class in a Java package without specifying each class explicitly. See here for Rich Hickey's response to essentially the same question: http://groups.google.com/group/clojure/browse_thread/thread/fa00a0ff4c264f9a

这并不妨碍您编写添加此功能的代码,但 Rich 还提到了为什么这可能很困难(Java 包不可枚举,因此您必须遍历类路径才能知道每个包中包含哪些类).

This does not preclude you from writing code that would add this functionality, but Rich also mentions why this could be difficult (Java packages are not enumerable, so you would have to walk the classpath to know what classes are inside each package).

这篇关于如何导入整个包但在 Clojure 中排除一些包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 06:55