Skip to content

Instantly share code, notes, and snippets.

@thomas-shares
Created April 11, 2012 08:29
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 thomas-shares/2357890 to your computer and use it in GitHub Desktop.
Save thomas-shares/2357890 to your computer and use it in GitHub Desktop.
Permutations and same start/end
(ns diversen.permutations)
(use 'clojure.math.combinatorics)
(def things '[:a :b :c])
(map #(conj % (last %) ) (permutations things))
;; ((:c :a :b :c) (:b :a :c :b) (:c :b :a :c) (:a :b :c :a) (:b :c :a :b) (:a :c :b :a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment