This seems like a bug in clojure.data.csv and someone should create a JIRA ticket for it, perhaps with a patch?
http://dev.clojure.org/jira/browse/DCSV This once again makes me question why this CSV library ended up in contrib (without any discussion) rather than the more actively maintained and widely used clojure-csv library by David Santiago - https://github.com/davidsantiago/clojure-csv On Wed, Feb 22, 2012 at 1:17 PM, Mark Rathwell <mark.rathw...@gmail.com> wrote: > I don't know that there is necessarily a recommended way to offer > options. Sometimes people want keyword options, sometime the want to > take options as a map, sometimes they need to do it one way or another > for various reasons, sometime they do it one way and later learn of a > better way. > > To take options in the way you have specified, you can use > destructuring to simplify: > > (defn write-csv [writer data & {:as opts}] ...) > - or - > (defn write-csv [writer data & {:keys [separator quote ...]}] ...) > - or - > (defn write-csv [writer data & {:keys [separator quote ...] :as opts}] ...) > > > On Wed, Feb 22, 2012 at 3:47 PM, Michael <michael-a...@db.com> wrote: >> clojure.data.csv has options for the following: >> >> (defn write-csv >> "Writes data to writer in CSV-format. >> >> Valid options are >> :separator (Default \\,) >> :quote (Default \\\") >> :guote? (A predicate function which determines if a string should >> be quoted. Defaults to quoting only when necessary.) >> :newline (:lf (default) or :cr+lf)" >> [writer data & options] >> (let [opts (into {} options) >> separator (or (:separator opts) \,) >> quote (or (:quote opts) \") >> quote? (or (:quote? opts) #(some #{separator quote \return >> \newline} %)) >> newline (or (:newline opts) :lf)] >> <snip> >> >> Since (into {} options) is used to get the options into a map, it >> seems that you need to specify options in this (write-csv writer data >> [:separator \;] [:newline :lf+cr]). >> >> Is this the recommended way to offer options? I was expecting (write- >> csv writer data :separator \; :newline :lf+cr). -- 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