Created
August 18, 2016 17:22
-
-
Save vkz/31b3d13c66c19a295a2615c6b69e5ae9 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
(defn apply-to-column-n | |
"Apply f only to column N in each table row. Columns start from column 1. | |
Gracefully do nothing for rows that are too short." | |
[f N table] | |
(map (fn [row] | |
(map (fn [n cell] | |
(if (= n N) | |
(f cell) | |
cell)) | |
(drop 1 (range)) | |
row)) | |
table)) | |
(apply-to-column-n | |
;; fn | |
(constantly "bla") | |
;; column number | |
2 | |
;; table: sequence of sequences | |
(read-annotations-from-xls "dev-resources/annotations.xlsx" "annotations")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment