|
@@ -64,7 +64,7 @@
|
|
|
col2 (second (re-find #":\s*([A-Z]+)" range-string))
|
|
|
row1 (.parseInt js/window (second (re-find #"([0-9]+)\s*:" range-string)))
|
|
|
row2 (.parseInt js/window (second (re-find #"([0-9]+)\s*\)" range-string)))]
|
|
|
- (range->list col1 col2 row1 row2)))
|
|
|
+ (range->list col1 row1 col2 row2)))
|
|
|
|
|
|
(def range->commalist
|
|
|
"Converts a range in \"A1:B2\" notation to a comma-separated list of cells: \"A1,A2,B1,B2\"."
|
|
@@ -76,7 +76,7 @@
|
|
|
(def replace-ranges-in-expression
|
|
|
"Receives an expression string, and replaces all ranges in colon notation (\"A1:B2\") into a comma-separated list of cells (\"A1,A2,B1,B2\")."
|
|
|
(memoize (fn [expression]
|
|
|
- (clojure.string/replace expression #"\(\s*[A-Z]+[0-9]+\s*:\s*[A-Z]+[0-9]+\s*\)" parse-range))))
|
|
|
+ (clojure.string/replace expression #"\(\s*[A-Z]+[0-9]+\s*:\s*[A-Z]+[0-9]+\s*\)" range->commalist))))
|
|
|
|
|
|
(defn formula?
|
|
|
"Determines if a value is a fomula. If it is, it returns it (without the leading equals sign. If not, it returns nil."
|
|
@@ -92,6 +92,7 @@
|
|
|
(map #(.toUpperCase %) $)
|
|
|
(filter #(re-matches #"[A-Z]+[0-9]+" %) $)))))
|
|
|
|
|
|
+
|
|
|
(def str->rc (memoize (fn [s]
|
|
|
(let [c (re-find #"^[A-Z]+" s)
|
|
|
r (.parseInt js/window (re-find #"[0-9]+$" s))]
|
|
@@ -223,7 +224,6 @@
|
|
|
(defn remove-valueless-range-elements
|
|
|
"Remove nil values specifically from ranges (to solve issues with some functions like average)."
|
|
|
[variables var-list]
|
|
|
- (println "remove-valueless-range-elements" variables var-list (first var-list))
|
|
|
(let [l (clojure.string/split (clojure.string/replace (first var-list) #"[()]" "") #",")
|
|
|
has-values (filter #(not (nil? (variables %))) l)]
|
|
|
(str "(" (clojure.string/join "," has-values) ")")))
|