<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On 18 Dec 2015, at 00:19, T.J. Usiyan via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">With a Cartesian Product type [like this](</span><a href="https://github.com/griotspeak/CartesianProduct" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://github.com/griotspeak/CartesianProduct</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">), the for-in-where syntax actually gets us to list comprehensions. I'll admit that I might not have implemented the best Cartesian Product type possible, but it should illustrate that we have what we need.</span><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><font class=""><font face="Consolas, Liberation Mono, Menlo, Courier, monospace" class=""><span style="font-size: 12px; line-height: 16px; white-space: pre;" class="">`for case … in cartProd(cartProd(seq1, seq2), seq3) // An operator for cartProd would make it more pleasing to read.`</span></font></font></div></div></blockquote></div><br class=""><div class="">That’s impressive work, but it strikes me as quite a difficult undertaking to get there. (Is it just me, or are generators and sequences the most scary part of Swift?) Also, is it possible to get it working as an expression, or is it restricted to a ‘for’ statement? If it can only be performed as a ‘for’ statement it will still need an external mutable var to be updated outside of the loop. It’s fine if you want to just do side-effecty things, like print the elements, but I’d consider the ability to return a value to be more important.</div><div class=""><br class=""></div><div class="">Al</div></body></html>