On Mon, Dec 8, 2008 at 9:45 AM, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > > Hi, > > On 8 Dez., 16:32, "Mark Volkmann" <[EMAIL PROTECTED]> wrote: >> I have some questions about the following: >> >> (use '[clojure.contrib.str-utils :only (str-join)]) >> >> Why is the vector quoted? Is that because we need to quote everything >> inside the vector? > > You don't have to quote the vector: > > (use ['clojure.contrib.str-utils :only '(str-join)]) > > So yes: quoting the vector quotes everything inside. > >> If so, what does it mean to quote the keyword :only? > > Nothing. ':only is the equivalent to :only. If you quote everything > else > you can leave the :only alone. > >> Why is the parameter to the use function a vector? > > It's not necessarily a vector: > > (use 'clojure.contrib.str-utils) > (use '(clojure.contrib str-utils def)) > (use '(clojure.contrib str-utils [def :only (defvar defstruct-)]))
It seems that this part [def :only (defvar defstruct-)] must be a vector and not a list. I'm finding it a little difficult to remember all the allowed permutations. Hopefully over time this will become second nature for me, but I'm not there yet. > The vector is used to associate parameters like > :only or :as to a given namespace. > >> Why can't the third item in the vector, (str-join), be specified with >> the symbol str-join instead of a list? > > It is possible to specify multiple arguments here (see above > example). Providing a non-list argument as a synonym for > a list containing this single argument is maybe possible. I'm > not familiar with the implementation, though. So I don't know > how easy it is to include this. I'd really like it if that were supported. It seems that most examples I see of using :only have a single function in the list that follows. Supporting this would be in keeping with the Clojure tendency to eliminate unnecessary parens. > Another point I'd like to raise (when we are talking about use > and require): Shouldn't require check, whether a namespace > already exists instead of keeping its own list of loaded > namespaces? -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---