On Sep 7, 10:40 pm, Sean Devlin <francoisdev...@gmail.com> wrote: > Okay, syntax question. When defining a namespace > > (ns my-ns > (:require [clojure.contrib [str-utils2 :as s]]) > (:import (java.util Regex Date Etc))) > > Why does the require use a vector, and the import statement use a > list? Could they both be vectors? This confused me when using imports > for a while. >
Using vectors in import seems to work: Clojure 1.1.0-alpha-SNAPSHOT user=> (ns blah (:import [java.util Collection Date])) java.util.Date blah=> Collection java.util.Collection blah=> Date java.util.Date blah=> I think the Clojure idiom is to prefer vectors over lists when representing ordered data--this provides a semantic cue that we are dealing with data and not a function call. It also prevents the need for quoting (although in this example it is unnecessary because ns is macro). My guess is that the prevalence of using lists for the :import clause is a legacy of the many former Lispers that have now become Clojure users. Or maybe there was a time when only a list was accepted? /mike --~--~---------~--~----~------------~-------~--~----~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---