[swift-evolution] higher kinded types vs Python's syntactic sugars

Al Skipp al_skipp at fastmail.fm
Fri Dec 18 06:35:56 CST 2015

> On 18 Dec 2015, at 00:19, T.J. Usiyan via swift-evolution <swift-evolution at swift.org> wrote:
> With a Cartesian Product type [like this](https://github.com/griotspeak/CartesianProduct <https://github.com/griotspeak/CartesianProduct>), 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.
> `for case … in cartProd(cartProd(seq1, seq2), seq3) // An operator for cartProd would make it more pleasing to read.`

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151218/95e027db/attachment.html>

More information about the swift-evolution mailing list