> On May 4, 2016, at 6:19 PM, bwm003--- via swift-users
> wrote:
>
> Hi Everyone,
> I was playing around in Xcode 7.3 with this code...
>
> /**
>
> * Represents a future value of type U, from a computation that has not been
> done yet.
> */
> public struct Promise {
> var futureValue
Hi Everyone,
I was playing around in Xcode 7.3 with this code...
*/***
* * Represents a future value of type U, from a computation that has not
been done yet.*
* */*
*public struct Promise {*
*var futureValue: T -> U*
*public func then(closure: U -> V) -> Promise {*
*retu
Thanks Dave and Matthew, I’ll start a thread on swift-evolution later today or
tomorrow.
- Dennis
> On May 5, 2016, at 5:09 PM, David Sweeris wrote:
>
> Seems like a nice feature, though. I think it'd be worth starting a thread on
> the evolution list. I don't know if it would be done in time
Seems like a nice feature, though. I think it'd be worth starting a thread on
the evolution list. I don't know if it would be done in time for 3.0, but it
doesn't hurt to try.
- Dave Sweeris
> On May 5, 2016, at 09:54, Matthew Johnson via swift-users
> wrote:
>
> Destructuring of parameters
Destructuring of parameters would be pretty cool. If it gets added to Swift it
should be a general feature for all functions, not just on closures. There are
a lot of design directions and subtleties that would need to be explored. I
doubt it is something that will be considered in the Swift
Thanks Krzysztof, you’re right! I totally forgot about that neat feature.
However, there’s no way to do this directly in the parameter list, right?
Do you think such feature should exist?
- Dennis
> On May 5, 2016, at 4:19 PM, Krzysztof Siejkowski
> wrote:
>
>>
>> A workaround is to declare
A workaround is to declare two local variables:
let e = zip(a,b).reduce(0) { acc, tuple in
let value1 = tuple.0
let value2 = tuple.1
return acc + value1 + value2
}
You can also get away with one assignment:
let ok = zip(a,b).reduce(0) { acc, tuple in
let (value1, value2) = tuple
re
Hi swift-users,
Is it possible to “extract” the `tuple` tuple in the following code directly
into two `Int` variables (`tuple` is of type `(Int, Int)`)?
let a = [0,1,2,3,4,5,6,7,8,9]
let b = [0,1,2,3,4,5,6,7,8,9]
let c = zip(a,b).reduce(0) { acc, tuple in
acc + tuple.0 + tuple.1
}
Like so (d