Created
June 24, 2010 17:58
-
-
Save candera/451734 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn cartes5 | |
[a b & [c & ds :as more]] | |
(let [so-far | |
(for [x a y b] | |
[x y])] | |
(if more | |
(recur so-far c ds) | |
(map flatten so-far)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
;; you got me thinking, how about...
(defn cross-prod [& colls](->> colls
%28reduce #%28for [x %1 y %2] [x y]%29%29
%28map flatten%29))