Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I import the entire package but exclude some in Clojure?

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)))

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

like image 259
unj2 Avatar asked Jul 30 '09 14:07

unj2


1 Answers

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

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).

like image 122
alanlcode Avatar answered Nov 03 '22 00:11

alanlcode