Skip to content

Instantly share code, notes, and snippets.

@dagda1
Created January 10, 2015 22:04
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 dagda1/d99bf42f31e99ae3b07c to your computer and use it in GitHub Desktop.
Save dagda1/d99bf42f31e99ae3b07c to your computer and use it in GitHub Desktop.
(letfn [(permutations [s]
(lazy-seq
(if (seq (rest s))
(apply concat (for [x s]
(map #(cons x %) (permutations (remove #{x} s)))))
[s])))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment