:only requires a list of characters. This is how the function is written. Note the docstring for refer , which uses use .
refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol
It is written so that you can specify more than one character if you want.
(use '[clojure.contrib.duck-streams :only (reader writer)])
As discussed in this recent post , if you write a function that accepts or returns a variable number of arguments, it is recommended that you always have it / return a list or a vector or set, even if it accepts / returns a single element. Because:
nil , often used to represent "null elements", possibly seq . Empty collections are also available seq .- Two or more list items are available
seq . - It also makes sense to be able to use a single
seq element, putting it in a list.
It would be inconvenient to have a case with one subject - a special case. It is more consistent and easier to program when you consider one subject as a kind of degenerate case and drop it into the list.
Note that all use cares whether the :only argument :only sequential character set. This means that all lists, vectors, and sets work.
(use '[clojure.contrib.duck-streams :only [reader writer]]) (use '[clojure.contrib.duck-streams :only
The only Symbol , however, is not capable of seq , so you get the exception you make.
Take a look at core.clj if you want to see how all this is implemented.
Brian carper
source share