Skip to content

Instantly share code, notes, and snippets.

@echosa
Created February 16, 2014 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save echosa/9028135 to your computer and use it in GitHub Desktop.
Save echosa/9028135 to your computer and use it in GitHub Desktop.
(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