<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=""><br class=""><div class="">
<div class="">-Dave</div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Dec 31, 2015, at 12:28 AM, Jacob Bandes-Storch &lt;<a href="mailto:jtbandes@gmail.com" class="">jtbandes@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: AvenirNext-Medium; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">With the optimizer as it is today, if this were @_transparent could the extra function invocation(s) be optimized out when you use it in a non-escaping context such as sort()?</div></div></blockquote><div><br class=""></div>Sure. &nbsp;It doesn’t need to be @_transparent; in general use @inline(__always) instead except in very special cases, (e.g. when you need constant folding to propagate through the function so you can give arithmetic overflow diagnostics at compile-time).</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: AvenirNext-Medium; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class="">Jacob<br class=""></div></div></div></div><br class=""><div class="gmail_quote">On Thu, Dec 31, 2015 at 12:26 AM, Dave Abrahams via swift-evolution<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class="">You don’t.&nbsp; Is that a problem for the intended use-cases?<div class=""><br class=""><div class=""><div class="">-Dave</div></div><div class=""><div class="h5"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 31, 2015, at 12:11 AM, Susan Cheng &lt;<a href="mailto:susan.doggie@gmail.com" target="_blank" class="">susan.doggie@gmail.com</a>&gt; wrote:</div><br class=""><div class="">And how do you write a @noescape version&nbsp;with this function?<span class=""></span><br class=""><br class="">Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" target="_blank" class="">dabrahams@apple.com</a>&gt; 於 2015年12月31日星期四 寫道:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class="">I don’t understand that argument.&nbsp; Obviously the function would be documented and there would be examples showing how to use it.&nbsp; Why would it confuse people?<div class=""><br class=""></div><div class="">I think you’d need much stronger reasons to justify adding an unbounded set of overloads (is every algorithm that takes a comparison closure going to get one of these?) when we can handle the problem economically with a single function.<br class=""><div class=""><div class=""><div class=""><br class=""><div class=""><div class="">-Dave</div></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 31, 2015, at 12:04 AM, Susan Cheng &lt;<a class="">susan.doggie@gmail.com</a>&gt; wrote:</div><br class=""><div class="">It confuses people if provide a&nbsp;global function&nbsp;<font size="2" class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">byComparing in stdlib which's doing nothing alone<span class=""></span>.</span></font><br class=""><br class="">Dave Abrahams &lt;<a class="">dabrahams@apple.com</a>&gt; 於 2015年12月31日星期四 寫道:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class="">Why add all those algorithms when you can write this</div><div class=""><br class=""></div><div class=""><div class=""><div class=""><font face="Menlo" class="">func byComparing&lt;T, U: Comparable&gt;(getComparisonKey: (T)-&gt;U) -&gt; (T, T) -&gt; Bool {</font></div><div class=""><font face="Menlo" class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>return { getComparisonKey($0) &lt; getComparisonKey($1) }</font></div><div class=""><font face="Menlo" class="">}</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">peoples.sort(byComparing { $<a href="http://0.name/" target="_blank" class="">0.name</a><span class="Apple-converted-space">&nbsp;</span>})</font></div><div class=""><br class=""></div><div class="">?</div><div class=""><br class=""></div>-Dave</div></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 30, 2015, at 10:38 PM, Susan Cheng via swift-evolution &lt;<a class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">Consider the follows:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color: rgb(187, 44, 162);" class="">struct</span><span class="Apple-converted-space">&nbsp;</span>Person {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">var</span><span class="Apple-converted-space">&nbsp;</span>name:<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">String</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">var</span><span class="Apple-converted-space">&nbsp;</span>age:<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">Int</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color: rgb(187, 44, 162);" class="">let</span><span class="Apple-converted-space">&nbsp;</span>peoples = [<span style="color: rgb(79, 129, 135);" class="">Person</span>(name:<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(209, 47, 27);" class="">"Hawk"</span>, age:<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(39, 42, 216);" class="">24</span>),<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(79, 129, 135);" class="">Person</span>(name:<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(209, 47, 27);" class="">"Andrew"</span>, age:<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(39, 42, 216);" class="">23</span>)]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color: rgb(187, 44, 162);" class="">let</span><span class="Apple-converted-space">&nbsp;</span>youngest =<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(79, 129, 135);" class="">peoples</span>.<span style="color: rgb(61, 29, 129);" class="">minElement</span><span class="Apple-converted-space">&nbsp;</span>{ $0.<span style="color: rgb(79, 129, 135);" class="">age</span><span class="Apple-converted-space">&nbsp;</span>&lt; $1.<span style="color: rgb(79, 129, 135);" class="">age</span><span class="Apple-converted-space">&nbsp;</span>}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="color: rgb(61, 29, 129);" class="">print</span><span class="">(</span>youngest<span class="">?.</span>name<span class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span class="">it's silly that we always have to write the code like<span class="Apple-converted-space">&nbsp;</span></span><span class="">{ $0.some &lt; $1.</span><span class="">some</span><span class="">&nbsp;} or&nbsp;</span><span class="">{&nbsp;</span><span class="">some</span><span class="">($0) &lt;&nbsp;</span><span class="">some</span><span class="">($1)</span><span class="">&nbsp;}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">so, we should add those methods to stdlib:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="color: rgb(187, 44, 162);" class="">extension</span><span class=""><span class="Apple-converted-space">&nbsp;</span></span>SequenceType<span class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// Returns the minimum element in `self` or `nil` if the sequence is empty.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">///</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// - Complexity: O(`elements.count`).</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">///</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>@warn_unused_result</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">public</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">func</span><span class="Apple-converted-space">&nbsp;</span>minElement&lt;R :<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">Comparable</span>&gt;(<span style="color: rgb(187, 44, 162);" class="">@noescape</span><span class="Apple-converted-space">&nbsp;</span>by: (Generator.Element)<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">throws</span><span class="Apple-converted-space">&nbsp;</span>-&gt; R)<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">rethrows</span><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">Generator</span>.<span style="color: rgb(112, 61, 170);" class="">Element</span>? {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">return</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">try</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">self</span>.<span style="color: rgb(61, 29, 129);" class="">minElement</span><span class="Apple-converted-space">&nbsp;</span>{<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">try</span><span class="Apple-converted-space">&nbsp;</span>by($0)<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(61, 29, 129);" class="">&lt;</span><span class="Apple-converted-space">&nbsp;</span>by($1) }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// Returns the maximum element in `self` or `nil` if the sequence is empty.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">///</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// - Complexity: O(`elements.count`).</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">///</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>@warn_unused_result</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">public</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">func</span><span class="Apple-converted-space">&nbsp;</span>maxElement&lt;R :<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">Comparable</span>&gt;(<span style="color: rgb(187, 44, 162);" class="">@noescape</span><span class="Apple-converted-space">&nbsp;</span>by: (Generator.Element)<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">throws</span><span class="Apple-converted-space">&nbsp;</span>-&gt; R)<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">rethrows</span><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">Generator</span>.<span style="color: rgb(112, 61, 170);" class="">Element</span>? {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">return</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">try</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">self</span>.<span style="color: rgb(61, 29, 129);" class="">maxElement</span><span class="Apple-converted-space">&nbsp;</span>{<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">try</span><span class="Apple-converted-space">&nbsp;</span>by($0)<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(61, 29, 129);" class="">&lt;</span><span class="Apple-converted-space">&nbsp;</span>by($1) }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="color: rgb(187, 44, 162);" class="">public</span><span class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="color: rgb(187, 44, 162);" class="">extension</span><span class=""><span class="Apple-converted-space">&nbsp;</span></span>MutableCollectionType<span class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// Return an `Array` containing the sorted elements of `source`.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// according to `by`.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">///</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// The sorting algorithm is not stable (can change the relative order of</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// elements that compare equal).</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>@warn_unused_result(mutable_variant="sortInPlace")</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="color: rgb(187, 44, 162);" class="">func</span><span class=""><span class="Apple-converted-space">&nbsp;</span>sort&lt;R :<span class="Apple-converted-space">&nbsp;</span></span>Comparable<span class="">&gt;(</span><span style="color: rgb(187, 44, 162);" class="">@noescape</span><span class=""><span class="Apple-converted-space">&nbsp;</span>by: (</span>Generator<span class="">.</span>Element<span class="">) -&gt;<span class="Apple-converted-space">&nbsp;</span></span>R<span class="">) -&gt; [</span>Generator<span class="">.</span>Element<span class="">] {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">return</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">self</span>.<span style="color: rgb(61, 29, 129);" class="">sort</span><span class="Apple-converted-space">&nbsp;</span>{ by($0)<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(61, 29, 129);" class="">&lt;</span><span class="Apple-converted-space">&nbsp;</span>by($1) }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color: rgb(187, 44, 162);" class="">public</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">extension</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">MutableCollectionType</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">where</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">Self</span>.Index : RandomAccessIndexType {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// Sort `self` in-place according to `by`.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">///</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// The sorting algorithm is not stable (can change the relative order of</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span>/// elements that compare equal).</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">mutating</span><span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">func</span><span class="Apple-converted-space">&nbsp;</span>sortInPlace&lt;R :<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">Comparable</span>&gt;(<span style="color: rgb(187, 44, 162);" class="">@noescape</span><span class="Apple-converted-space">&nbsp;</span>by: (<span style="color: rgb(112, 61, 170);" class="">Generator</span>.<span style="color: rgb(112, 61, 170);" class="">Element</span>) -&gt;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">R</span>) {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(187, 44, 162);" class="">self</span>.<span style="color: rgb(61, 29, 129);" class="">sortInPlace</span><span class="Apple-converted-space">&nbsp;</span>{ by($0)<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(61, 29, 129);" class="">&lt;</span><span class="Apple-converted-space">&nbsp;</span>by($1) }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div class=""><br class=""></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=JfMPa-2F7wwZPzsZ3QKA8NjtONIYX4SjbWuUxtpfsTY2hlalHAlXXQWhHvthJG-2BHbU6XIVq65CJWZ-2F0CTirC6jnYzWxvt7Xc-2BMGls-2B5pihB9p-2FQwEKtYC4ag7sx7taELCdT1dRwRpgk6xGwiWEI0dkd1BBB8fXICs7BqciC0dFo4tBlefw1Ov6wlDL9odNZyWSjYYlPKLHKZXMDKF0P-2BmVsgAIne37-2FbKxF0IVKSbWfb8-3D" alt="" width="1" height="1" border="0" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></blockquote></div></blockquote></div><br class=""></div></div></div></div></div></blockquote></div></blockquote></div><br class=""></div></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qydYQLTjlJ3kKVFIREyApZNJ-2FyPQfWCPyh69JgDXpGjM738lY7r1JSRXBPFCN8GoUBYyRkBwv0aPnr3-2FSrWz95QhtgqimHNj-2FC25-2FcZ7AuRQeXRv18SJnSqpzRrwS-2Fh9w0-2BaY-2B8ufGo6ehd4DlRWq-2BVWSxliWta7MsLFEVOaWTt33DsBuuvzsXb0VFu6EnrAA4-3D" alt="" width="1" height="1" border="0" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""></div><br class="">_______________________________________________<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" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></blockquote></div></div></div></div></blockquote></div><br class=""></body></html>