Skip to content

Instantly share code, notes, and snippets.

@tomjack
Created May 21, 2011 23:20
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 tomjack/086a50ba2a402fb6ea2e to your computer and use it in GitHub Desktop.
Save tomjack/086a50ba2a402fb6ea2e to your computer and use it in GitHub Desktop.
(defn random-permutation [n]
(->> (range n)
((juxt identity shuffle))
(apply map vector)
(into {})))
(defn permute [p v]
(into {} (for [[k f] v]
[(p k) f])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment