Skip to content

Instantly share code, notes, and snippets.

@uroybd
Last active August 29, 2015 14:27
Show Gist options
  • Save uroybd/5978630533c5b4e71353 to your computer and use it in GitHub Desktop.
Save uroybd/5978630533c5b4e71353 to your computer and use it in GitHub Desktop.
(defn move
([dvec direction indx]
(cond (= direction :up) (move dvec :swap indx (dec indx))
(= direction :down) (move dvec :swap indx (inc indx))
:else (println "Wrong Number of args")))
([dvec direction indx1 indx2]
(if (= direction :swap)
(assoc dvec indx2 (nth dvec indx1) indx1 (nth dvec indx2))
(println "Invalid arguments"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment