<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>On Thu, Jun 23, 2016, at 11:18 PM, Erica Sadun wrote:<br></div>
<blockquote type="cite"><div>&nbsp;</div>
<div><blockquote type="cite"><div>On Jun 23, 2016, at 9:04 PM, Ryan Lovelett via swift-users &lt;<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>&gt; wrote:<br></div>
<div>&nbsp;</div>
<div><div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">extension Dictionary {</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">&nbsp;&nbsp;&nbsp;init&lt;S: Sequence where S.Iterator.Element == Element&gt;(pairs: S) {</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.init()</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (key, value) in pairs {</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self[key] = value</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">&nbsp;&nbsp;&nbsp;}</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">}</span></span><br></div>
<div>&nbsp;</div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">let foo = ["Lorem", "ipsum"]</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">let bar = ["dolor", "sit"]</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">let baz = zip(foo, bar)</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">let qux = baz.lazy</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">&nbsp;&nbsp;&nbsp;.map({ ($0.uppercased(), $1.uppercased()) })</span></span><br></div>
<div>&nbsp;</div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">Dictionary(pairs: baz)</span></span><br></div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">Dictionary(pairs: qux)</span></span><br></div>
</div>
</blockquote></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(112, 61, 170);"><span class="colour" style="color:rgb(187, 44, 162)">extension</span><span class="colour" style="color:rgb(0, 0, 0)"> </span><span style="font-variant-ligatures:no-common-ligatures;">Dictionary</span><span class="colour" style="color:rgb(0, 0, 0)"> {</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span style="font-variant-ligatures:no-common-ligatures;"> </span><span class="colour" style="color:rgb(187, 44, 162)">init</span><span style="font-variant-ligatures:no-common-ligatures;">&lt;S: </span><span class="colour" style="color:rgb(112, 61, 170)">Sequence</span><span style="font-variant-ligatures:no-common-ligatures;"> </span><span class="colour" style="color:rgb(187, 44, 162)">where</span><span style="font-variant-ligatures:no-common-ligatures;"> </span><span class="colour" style="color:rgb(79, 129, 135)">S</span><span style="font-variant-ligatures:no-common-ligatures;">.Iterator.Element == (</span><span class="colour" style="color:rgb(112, 61, 170)">Key</span><span style="font-variant-ligatures:no-common-ligatures;">, </span><span class="colour" style="color:rgb(112, 61, 170)">Value</span><span style="font-variant-ligatures:no-common-ligatures;">)&gt;(pairs: </span><span class="colour" style="color:rgb(79, 129, 135)">S</span><span style="font-variant-ligatures:no-common-ligatures;">) {</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span style="font-variant-ligatures:no-common-ligatures;"> </span><span class="colour" style="color:rgb(187, 44, 162)">self</span><span style="font-variant-ligatures:no-common-ligatures;">.</span><span class="colour" style="color:rgb(187, 44, 162)">init</span><span style="font-variant-ligatures:no-common-ligatures;">()</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span style="font-variant-ligatures:no-common-ligatures;"> </span><span class="colour" style="color:rgb(187, 44, 162)">for</span><span style="font-variant-ligatures:no-common-ligatures;"> (key, value) </span><span class="colour" style="color:rgb(187, 44, 162)">in</span><span style="font-variant-ligatures:no-common-ligatures;"> pairs {</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span style="font-variant-ligatures:no-common-ligatures;"> </span><span class="colour" style="color:rgb(187, 44, 162)">self</span><span style="font-variant-ligatures:no-common-ligatures;">[key] = value</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span style="font-variant-ligatures:no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span style="font-variant-ligatures:no-common-ligatures;">&nbsp; &nbsp; }</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span style="font-variant-ligatures:no-common-ligatures;">}</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;min-height:19px;">&nbsp;</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(209, 47, 27);"><span class="colour" style="color:rgb(187, 44, 162)">let</span><span class="colour" style="color:rgb(0, 0, 0)"> foo = [</span><span style="font-variant-ligatures:no-common-ligatures;">"Lorem"</span><span class="colour" style="color:rgb(0, 0, 0)">, </span><span style="font-variant-ligatures:no-common-ligatures;">"ipsum"</span><span class="colour" style="color:rgb(0, 0, 0)">]</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(209, 47, 27);"><span class="colour" style="color:rgb(187, 44, 162)">let</span><span class="colour" style="color:rgb(0, 0, 0)"> bar = [</span><span style="font-variant-ligatures:no-common-ligatures;">"dolor"</span><span class="colour" style="color:rgb(0, 0, 0)">, </span><span style="font-variant-ligatures:no-common-ligatures;">"sit"</span><span class="colour" style="color:rgb(0, 0, 0)">]</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">let</span><span style="font-variant-ligatures:no-common-ligatures;"> baz = </span><span class="colour" style="color:rgb(61, 29, 129)">zip</span><span style="font-variant-ligatures:no-common-ligatures;">(</span><span class="colour" style="color:rgb(79, 129, 135)">foo</span><span style="font-variant-ligatures:no-common-ligatures;">, </span><span class="colour" style="color:rgb(79, 129, 135)">bar</span><span style="font-variant-ligatures:no-common-ligatures;">)</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">let</span><span style="font-variant-ligatures:no-common-ligatures;"> qux = </span><span class="colour" style="color:rgb(79, 129, 135)">baz</span><span style="font-variant-ligatures:no-common-ligatures;">.</span><span class="colour" style="color:rgb(112, 61, 170)">lazy</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span style="font-variant-ligatures:no-common-ligatures;">&nbsp; &nbsp; .</span><span class="colour" style="color:rgb(61, 29, 129)">map</span><span style="font-variant-ligatures:no-common-ligatures;">({ ($0.</span><span class="colour" style="color:rgb(61, 29, 129)">uppercased</span><span style="font-variant-ligatures:no-common-ligatures;">(), $1.</span><span class="colour" style="color:rgb(61, 29, 129)">uppercased</span><span style="font-variant-ligatures:no-common-ligatures;">()) })</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;min-height:19px;">&nbsp;</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(61, 29, 129)">print</span><span style="font-variant-ligatures:no-common-ligatures;">(</span><span class="colour" style="color:rgb(112, 61, 170)">Dictionary</span><span style="font-variant-ligatures:no-common-ligatures;">(pairs: </span><span class="colour" style="color:rgb(79, 129, 135)">baz</span><span style="font-variant-ligatures:no-common-ligatures;">))</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(61, 29, 129)">print</span><span style="font-variant-ligatures:no-common-ligatures;">(</span><span class="colour" style="color:rgb(112, 61, 170)">Dictionary</span><span style="font-variant-ligatures:no-common-ligatures;">(pairs: </span><span class="colour" style="color:rgb(79, 129, 135)">qux</span><span style="font-variant-ligatures:no-common-ligatures;">))</span><br></div>
</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;">&nbsp;</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;"><span style="font-variant-ligatures:no-common-ligatures;">-- E</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;line-height:normal;font-family:Menlo;">&nbsp;</div>
</blockquote><div>&nbsp;</div>
<div>Thank you 🙏<br></div>
</body>
</html>