Created
December 10, 2012 15:06
-
-
Save msgodf/4251107 to your computer and use it in GitHub Desktop.
Generate all pairs of the integers [0,n), excluding those of the form [a,a] and only the first pair of the symmetric [a,b] [b,a]
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 different-int-pairs | |
"Generate all pairs of the integers [0,n), excluding those of the form [a,a] and only the first pair of the symmetric [a,b] [b,a]" | |
[n] | |
(mapcat (fn [x] (map #(vector x %) | |
(range (inc x) n))) | |
(range n))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment