Skip to content

Instantly share code, notes, and snippets.

@optevo
Created January 12, 2014 13:01
Show Gist options
  • Save optevo/8384327 to your computer and use it in GitHub Desktop.
Save optevo/8384327 to your computer and use it in GitHub Desktop.
Change vars to fn/let and wrap
(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