;; Function to generate permutations using reduce (defn permutations [coll] (reduce (fn [acc x] (for [perm acc i (range (inc (count perm)))] (concat (take i perm) [x] (drop i perm)))) [[]] ; Start with an empty permutation coll)) ;; Example usage (permutations [1 2 3]) ;; => ((3 2 1) (2 3 1) (2 1 3) (3 1 2) (1 3 2) (1 2 3))
clojure.core, by purposeClojure String utilities It is poor form to (:use clojure.string).
This file defines a generic tree walker for Clojure data structures.
This file defines polymorphic I/O utility functions for Clojure.