Saturday, October 18, 2008

Clojure Golf: combinations

(defn combinations [& cs]
(reduce (fn [vs c]
(mapcat #(map conj vs (repeat %)) c))
[[]] cs))

1 comment:

Note: Only a member of this blog may post a comment.