> Also, it's worth pointing out that your newer version prints the
> combinations out in a non-standard order.
Good point ... I shouldn't have tried to avoid adding the "let":
(defn combinations "Take a seq of seqs and return a lazy list of
ordered combinations (pick 1 from each seq)"
[seqs]
(if (empty? seqs) '(())
(let [rec (combinations (rest seqs))]
(for [item (first seqs)
rst rec]
(cons item rst)))))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---