<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="">I agree with karl. there is nothing really mathematical with min/max<div class=""><br class=""></div><div class="">e.g. find the longest sequence of characters in a string or the smallest array or the minimal x coordinate of view objects…</div><div class="">min/max/clamp are needed everywhere.</div><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); 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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); 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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">LG</div><div class="">Dominik</div><div class=""><br class=""></div><div class="">Web: <a href="https://pich.info" class="">https://pich.info</a></div><div class="">Twitter: @DaijDjan</div><div class="">Facebook: Dominik.Pich</div></div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Aug 31, 2016, at 3:53 PM, Xiaodi Wu 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 style="white-space:pre-wrap" class="">Comparable makes semantic guarantees about how values of conforming types might be ordered. You don't need `min` or `max` for that to be useful, since it's trivial to implement using comparison operators.<br class=""><br class="">Basic numeric types require compiler magic and thus belong in the standard library. Likewise, dictionaries have special syntactic sugar and have uses for types that can guarantee comparable semantics. A decimal type, though, can be implemented outside the standard library and probably would belong in a math library. Likewise mathematical constants such as e. I think min and max fall into the latter category.<br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Aug 31, 2016 at 8:10 AM Karl &lt;<a href="mailto:razielim@gmail.com" target="_blank" class="">razielim@gmail.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
&gt; On 30 Aug 2016, at 10:18, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class="">
&gt;<br class="">
&gt; As an additive proposal, I don't think this would be in scope for the current phase of Swift 4.<br class="">
&gt;<br class="">
&gt; Looking forward, though, I'm not sure this belongs in the standard library. In general, my understanding is that Swift's standard library is deliberately small, and that the criteria for additions are that it's widely used *and* also non-trivial for the user to write correctly. I've had to use clamping, obviously, but it's a trivial one-liner that is hard to write incorrectly. If anything, I'd be in favor of removing max and min into a future math library outside the standard library.<br class="">
<br class="">
min &amp; max (and clamping) are hardly “math” operations. They operate on Comparables, so you can apply them to more abstract things than just numbers.<br class="">
<br class="">
Otherwise, you might as well put Comparable and all standard numeric types like Int and Float in a math library, too.</blockquote></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>