Created
February 16, 2014 01:51
-
-
Save echosa/9028135 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 set-thing-at-grid-position [grid position thing] | |
"Sets the position of grid to THING, then returns the new grid." | |
(let [x (first position) | |
y (nth position 1)] | |
(into (conj (subvec grid 0 y) | |
(into (conj (subvec (first (subvec grid y (inc y))) 0 x) | |
thing) | |
(subvec (first (subvec grid y (inc y))) (inc x)))) | |
(subvec grid (inc y))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment