<div dir="ltr">I'm for making it clearer, not for removing it.<div><br></div><div>If I understand correctly we would lose the ability to do this:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">func</span> compose<A,B,C>(lhs: <span style="color:rgb(112,61,170)">A</span> -> <span style="color:rgb(112,61,170)">B</span>, rhs: <span style="color:rgb(112,61,170)">B</span> -> <span style="color:rgb(112,61,170)">C</span>) -> <span style="color:rgb(112,61,170)">A</span> -> <span style="color:rgb(112,61,170)">C</span> {</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">return</span> { rhs(lhs($0)) }</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">let</span> apply: (<span style="color:rgb(112,61,170)">Int</span>,<span style="color:rgb(112,61,170)">Int</span>)-><span style="color:rgb(112,61,170)">Int</span> = <span style="color:rgb(49,89,93)">compose</span>(+, rhs: <span style="color:rgb(61,29,129)">abs</span>)</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">
</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="color:rgb(61,29,129)">print</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(209,47,27)">"result: "</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(79,129,135)">apply</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(39,42,216)">1</span><span style="color:rgb(0,0,0)">,-</span><span style="color:rgb(39,42,216)">5</span><span style="color:rgb(0,0,0)">)) </span>// prints 4, ie. abs(1 + -5)</p></div></blockquote><font color="#008400" face="Menlo"><span style="font-size:11px"><br></span></font><div><div>It's nice at the moment to be able to do generalised functions on functions without needing versions for every combination of parameter count.</div></div><div><br></div><div>The biggest use case for me is generics, specifically functions on functions and testing libraries.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 28, 2016 at 6:41 AM, Chris Lattner via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Jan 27, 2016, at 11:32 AM, Jarod Long <<a href="mailto:swift@lng.la" target="_blank">swift@lng.la</a>> wrote:</div><br><div><div style="word-wrap:break-word"><div>But failure in this case is a function that takes two arguments, and failureStubs is an array of tuples that map to that function's arguments. How do the tuple values get mapped to the arguments if not via tuple splatting?</div></div></div></blockquote><div><br></div></span><div>Ah ok, I was looking at the success case I guess. You’re right. In this case, instead of :</div><div><br></div><div> failure(failureStubs.removeFirst())<br><br></div><div>you’d have to write something like this:</div><div><br></div><div> let tmp = failureStubs.removeFirst()</div><div> failure(tmp.0, tmp.1)<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Chris</div></font></span><span class=""><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><br></div><div>Jarod</div><br><div><blockquote type="cite"><div>On Jan 27, 2016, at 11:28, Chris Lattner <<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>> wrote:</div><div><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Jan 27, 2016, at 11:24 AM, <a href="mailto:swift@lng.la" target="_blank">swift@lng.la</a> wrote:</div><br><div><div style="word-wrap:break-word"><div>Apologies -- I just realized I chose a bad example that isn't actually using the feature, but the usage would be here:</div><div><br></div><div><div style="font-family:Menlo;color:rgb(79,129,135);margin:0px;font-size:11px;line-height:normal"><span style="color:rgb(187,44,162)">if</span><span> </span>successStubs<span>.</span><span style="color:rgb(112,61,170)">count</span><span> > </span><span style="color:rgb(39,42,216)">0</span><span> {</span></div><div style="font-family:Menlo;color:rgb(59,59,59);margin:0px;font-size:11px;line-height:normal"> success(<span style="color:rgb(79,129,135)">successStubs</span>.<span style="color:rgb(61,29,129)">removeFirst</span>())</div><div style="font-family:Menlo;color:rgb(59,59,59);margin:0px;font-size:11px;line-height:normal">}</div><div style="font-family:Menlo;color:rgb(79,129,135);margin:0px;font-size:11px;line-height:normal"><span style="color:rgb(187,44,162)">else</span><span> </span><span style="color:rgb(187,44,162)">if</span><span> </span>failureStubs<span>.</span><span style="color:rgb(112,61,170)">count</span><span> > </span><span style="color:rgb(39,42,216)">0</span><span> {</span></div><div style="font-family:Menlo;color:rgb(59,59,59);margin:0px;font-size:11px;line-height:normal"> failure(<span style="color:rgb(79,129,135)">failureStubs</span>.<span style="color:rgb(61,29,129)">removeFirst</span>())</div><div style="font-family:Menlo;color:rgb(59,59,59);margin:0px;font-size:11px;line-height:normal">}</div></div></div></div></blockquote><div><br></div><div>This isn’t using the feature either. You are passing a single value (returned by removeFirst) as a single argument. No spat is happening.</div></div><br><div>-Chris</div></div></div></blockquote></div><br></div></div></blockquote></span></div><br></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>