Skip to content

Instantly share code, notes, and snippets.

@jColeChanged
Created March 2, 2011 05:33
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 jColeChanged/850531 to your computer and use it in GitHub Desktop.
Save jColeChanged/850531 to your computer and use it in GitHub Desktop.
Naive Implementation of rotate left and rotate right.
(defn rotatel
([n col]
(let [n (mod n (count col))]
(concat
(drop n col)
(take n col))))
([col]
(rotatel 1 col)))
(defn rotater
([n col]
(let [n (mod n (count col))]
(concat
(take-last n col)
(drop-last n col))))
([col]
(rotater 1 col)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment