Created
January 12, 2014 13:01
-
-
Save optevo/8384327 to your computer and use it in GitHub Desktop.
Change vars to fn/let and wrap
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 grid [rows cols] | |
(let [cells (for [row (range rows), col (range cols)] [row col])] | |
(defn select-cells-by-row [row] | |
(filter (fn [[r c]] (= row r)) cells)) | |
(defn print-cells-by-row [row] | |
(doseq [cell (select-cells-by-row row)] | |
(println cell))) | |
) | |
print-cells-by-row | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment