Created
November 16, 2017 19:53
-
-
Save rafaelrinaldi/68ccefb3a23ccce09919f745114dac3b to your computer and use it in GitHub Desktop.
This file contains 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
(defn str->num [x] | |
(-> (NumberFormat/getInstance (Locale/forLanguageTag "en-US")) (.parse x))) | |
(defn numeric? [x] | |
(try | |
(str->num x) | |
(catch ParseException pe false))) | |
(defn vector-of-vectors? [x] | |
(every? vector? x)) | |
(defn cell-text [list] | |
(mapv #(:text %) list)) | |
;; Make sure the list has only one level as the spreadsheet generator expects | |
(defn normalize [list] | |
(reduce (fn [acc x] | |
(if (vector-of-vectors? x) | |
(into acc x) | |
(conj acc x))) | |
[], list)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment