(defn pairs
"returns unique pairs of a and b where members of a and b can not be paired with the correspoding slot in the other list."
[a b]
((fn combine [combos ra rb]
(let [heada (first ra)
level-combos (for [bx (rest rb)]
[heada bx])
all-combos (concat combos level-combos)]
(if (= 0 (count (rest ra)))
all-combos
(combine all-combos (rest ra) (rest rb))))) [] a b))
Comments top
No comments for pairs. Log in to add a comment.