[swift-evolution] higher kinded types vs Python's syntactic sugars
T.J. Usiyan
griotspeak at gmail.com
Fri Dec 18 10:50:37 CST 2015
Shouldn't `filter` accomplish that?
On Fri, Dec 18, 2015 at 7:35 AM, Al Skipp <al_skipp at fastmail.fm> wrote:
> 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), 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.
>
> Al
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151218/4849689b/attachment.html>
More information about the swift-evolution
mailing list