Created
January 14, 2015 22:07
-
-
Save thbishop/a26a3a538a03c753ce77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def headers->keywords (array-map "Name" :name, "Glitter Index" :glitter-index)) | |
(defn csv-headers [] (s/join "," (keys headers->keywords))) | |
(defn data->csv | |
"Converts ({:name 'Foo' :glitter-index 10} to 'Foo,10')" | |
[data] | |
(clojure.string/join "\n" (cons csv-headers ["foo,bar"])))) | |
; this returns | |
; "fwpd.core$csv_headers@2bfe621e\nfoo,bar" | |
; all we change is csv-headers from defn to def | |
(def headers->keywords (array-map "Name" :name, "Glitter Index" :glitter-index)) | |
(def csv-headers (s/join "," (keys headers->keywords))) | |
(defn data->csv | |
"Converts ({:name 'Foo' :glitter-index 10} to 'Foo,10')" | |
[data] | |
(clojure.string/join "\n" (cons csv-headers ["foo,bar"]))) | |
; this returns (which is what i'm after) | |
; "Name,Glitter Index\nfoo,bar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment