<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Some thoughts after reviewing it a second time:<div class=""><br class=""></div><div class="">I am not sure I like having global functions first(_:_:) and last(_:_:). &nbsp;Would it be possible to default the closure to do what last(_:_:) would do? &nbsp;I'm assuming the most popular thing to do is to have the values from the second dictionary prevail.&nbsp;</div><div class=""><br class=""></div><div class=""><div class=""><font color="#009109" face="Monaco" class=""><span style="font-size: 12px;" class="">// These two would be equivalent to passing last(_:_:) function</span></font></div><div class=""><div class=""><font face="Monaco" style="font-size: 12px;" class="">let newDict = dict1.merged(with: dict2)<span class="Apple-tab-span" style="white-space: pre;">                </span></font></div><div class=""><div class=""><font face="Monaco" style="font-size: 12px;" class="">let newDict = dict1.merged(with: dict2) { $1 }<span class="Apple-tab-span" style="white-space: pre;">                </span></font></div></div></div></div><div class=""><br class=""></div><div class="">If someone wanted to do what first(_:_:) would do, or some other algorithm then it would be quite simple, wouldn't it? &nbsp;For example:</div><div class=""><br class=""></div><div class=""><font face="Monaco" style="font-size: 12px;" color="#009109" class="">// This would be equivalent to passing in the first(_:_) function</font></div><div class=""><font face="Monaco" style="font-size: 12px;" class="">let newDict = dict1.merged(with: dict2) { $0 }<span class="Apple-tab-span" style="white-space:pre">                </span></font></div><div class=""><font face="Monaco" style="font-size: 12px;" class=""><br class=""></font></div><div class=""><div class=""><font face="Monaco" color="#009109" class=""><span style="font-size: 12px;" class="">// Combine values of&nbsp;common keys by adding them</span></font></div><div class=""><font face="Monaco" style="font-size: 12px;" class="">let newDict = dict1.merged(with: dict2) { $0 + $1 }<span class="Apple-tab-span" style="white-space: pre;">                </span></font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Apr 1, 2017, at 3:58 PM, Nate Cook via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Yep, here it is -- didn't realize the length would cause such problems!<div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://gist.github.com/natecook1000/4bd8f20736eb99ed3c5a4cdcc41e9a5f" class="">https://gist.github.com/natecook1000/4bd8f20736eb99ed3c5a4cdcc41e9a5f</a></div><div class=""><br class=""></div><div class="">Nate</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 1, 2017, at 12:01 PM, Jason Gregori via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I really like the merging methods and have already needed to write my own. Zach, do you mind showing a comparison of what you're thinking?&nbsp;</div><div class=""><br class=""></div><div class="">Nate, do you mind throwing this up in a gist or something? My email client isn't letting me see the whole thing.&nbsp;</div><div class=""><br class=""></div><div class="">Thanks,&nbsp;</div><div class="">Jason</div><div class=""><br class=""></div><div class=""><br class=""><div class="gmail_quote"><div class="">On Fri, Mar 31, 2017 at 11:52 AM Zach Waldowski via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u class="gmail_msg"></u>




<div class="gmail_msg"><div style="font-family:Arial" class="gmail_msg">Snipped quoted proposal so as to not break the mailing list… By and large, I'm in favor. I like the potential for bringing up Dictionary and Set up to the implementation quality of Array and String.<br class="gmail_msg"></div>
<div style="font-family:Arial" class="gmail_msg"><br class="gmail_msg"></div>
<div style="font-family:Arial" class="gmail_msg">I don't think `init(merging:resolvingCollisionsWith:)` et al hold their weight for inclusion in the language, unless some notable optimization opportunity can be surfaced out of it. Users frustrated at the lack of a `merge` in Swift want it to be opinionated and "just do the right thing," i.e., the same way as whatever other language they most recently used. A properly annotated and indented-to-be-beautiful use of the closure-based version will take up the same amount of code as doing the merge by hand with your custom condition. <br class="gmail_msg"></div>
<div style="font-family:Arial" class="gmail_msg"><br class="gmail_msg"></div>
<div id="m_-6106093374295642008sig40804545" class="gmail_msg"><div class="gmail_msg m_-6106093374295642008signature"><span class="gmail_msg m_-6106093374295642008font" style="font-family:arial,sans-serif,sans-serif">Sincerely,</span><span class="gmail_msg m_-6106093374295642008font" style="font-family:arial,sans-serif,sans-serif"></span><br class="gmail_msg"></div>
<div class="gmail_msg m_-6106093374295642008signature"><span class="gmail_msg m_-6106093374295642008font" style="font-family:arial,sans-serif,sans-serif">&nbsp; Zachary Waldowski</span><span class="gmail_msg m_-6106093374295642008font" style="font-family:arial,sans-serif,sans-serif"></span><br class="gmail_msg"></div>
<div class="gmail_msg m_-6106093374295642008signature"><span class="gmail_msg m_-6106093374295642008font" style="font-family:arial,sans-serif,sans-serif">&nbsp;&nbsp;</span><a href="mailto:zach@waldowski.me" class="gmail_msg" target="_blank"><span class="gmail_msg m_-6106093374295642008font" style="font-family:arial,sans-serif,sans-serif">zach@waldowski.me</span></a><br class="gmail_msg"></div>
</div>
<div class="gmail_msg"><br class="gmail_msg"></div>
</div>

_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>