On Thu, Jun 23, 2016, at 11:18 PM, Erica Sadun wrote:
>
>> On Jun 23, 2016, at 9:04 PM, Ryan Lovelett via swift-users <swift-
>> [email protected]> wrote:
>>
>> extension Dictionary {
>> init<S: Sequence where S.Iterator.Element == Element>(pairs: S) {
>> self.init()
>> for (key, value) in pairs {
>> self[key] = value
>> }
>> }
>> }
>>
>> let foo = ["Lorem", "ipsum"]
>> let bar = ["dolor", "sit"]
>> let baz = zip(foo, bar)
>> let qux = baz.lazy
>> .map({ ($0.uppercased(), $1.uppercased()) })
>>
>> Dictionary(pairs: baz)
>> Dictionary(pairs: qux)
>
>
> extension Dictionary {
>  init<S: Sequence where S.Iterator.Element == (Key,
>  Value)>(pairs: S) {
>  self.init()
>  for (key, value) in pairs {
>  self[key] = value
> }
> }
> }
>
> let foo = ["Lorem", "ipsum"]
> let bar = ["dolor", "sit"]
> let baz = zip(foo, bar)
> let qux = baz.lazy
> .map({ ($0.uppercased(), $1.uppercased()) })
>
> print(Dictionary(pairs: baz))
> print(Dictionary(pairs: qux))
>
> -- E
>
 
Thank you 🙏
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to