<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="">Function currying wasn’t removed, just some of the confusing syntax for it. This works fine in the Xcode 8 beta:<div class=""><div style="margin: 0px; line-height: normal;" class=""><span style="color: rgb(211, 54, 130); font-family: 'Fira Mono'; font-variant-ligatures: no-common-ligatures;" class="">infix</span><span style="color: rgb(147, 161, 161); font-family: 'Fira Mono'; font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color: rgb(211, 54, 130); font-family: 'Fira Mono'; font-variant-ligatures: no-common-ligatures;" class="">operator</span><span style="color: rgb(147, 161, 161); font-family: 'Fira Mono'; font-variant-ligatures: no-common-ligatures;" class=""> <> {} </span><font color="#cb4b16" face="Fira Mono" class="">// random operator that doesn’t do anything else</font></div><div style="margin: 0px; line-height: normal; font-family: 'Fira Mono'; color: rgb(147, 161, 161);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> <> <T, U, V> (op: (</span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">U</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">V</span><span style="font-variant-ligatures: no-common-ligatures" class="">, rhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">U</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> ((</span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">V</span><span style="font-variant-ligatures: no-common-ligatures" class="">) { </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 54, 130);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> { op($0, rhs) } </span>}</div><div style="margin: 0px; line-height: normal; font-family: 'Fira Mono'; color: rgb(147, 161, 161);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> <> <T, U, V> (lhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">, op: (</span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">U</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">V</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> ((</span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">U</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">V</span><span style="font-variant-ligatures: no-common-ligatures" class="">) { </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 54, 130);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> { op(lhs, $0) } </span>}</div><div style="margin: 0px; line-height: normal; font-family: 'Fira Mono'; color: rgb(147, 161, 161);" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> divby2 = (/) </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class=""><></span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">2</span></div><div style="margin: 0px; line-height: normal; color: rgb(203, 75, 22);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #278bd2" class="">print</span><span style="font-variant-ligatures: no-common-ligatures; color: #93a1a1" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">divby2</span><span style="font-variant-ligatures: no-common-ligatures; color: #93a1a1" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">10</span><span style="font-variant-ligatures: no-common-ligatures; color: #93a1a1" class="">)) </span><span style="font-variant-ligatures: no-common-ligatures" class="">// prints "5"</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> invert = </span><span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">1.0</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class=""><></span><span style="font-variant-ligatures: no-common-ligatures" class=""> (/)</span></div><div style="margin: 0px; line-height: normal; color: rgb(203, 75, 22);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #278bd2" class="">print</span><span style="font-variant-ligatures: no-common-ligatures; color: #93a1a1" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">invert</span><span style="font-variant-ligatures: no-common-ligatures; color: #93a1a1" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">10</span><span style="font-variant-ligatures: no-common-ligatures; color: #93a1a1" class="">)) </span><span style="font-variant-ligatures: no-common-ligatures" class="">// prints "0.1"</span></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">More to the point, though, given this definition:</span></div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><div style="color: rgb(147, 161, 161); font-family: 'Fira Mono'; margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> foo: (</span><span style="font-variant-ligatures: no-common-ligatures; color: #278bd2" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> (</span><span style="font-variant-ligatures: no-common-ligatures; color: #278bd2" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> (</span><span style="font-variant-ligatures: no-common-ligatures; color: #278bd2" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; line-height: normal;" class="">Would the correct way to use `foo` with today’s syntax be "foo(Int) -> (Int, Int)”, "foo(Int) -> ((Int) -> Int)”, or "foo(Int, Int) -> Int”?</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">Seems like a lot of confusion and ambiguity for something that, at least as far as I can tell, doesn’t actually provide any functionality.</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div></div></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">- Dave Sweeris</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div><blockquote type="cite" class=""><div class="">On Jun 15, 2016, at 2:07 PM, J. Charles N. MBIADA via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div class="">Hi Swift,</div><div class=""><br data-mce-bogus="1" class=""></div><div class="">Since the "removal" of curried function, I am looking for some elegant ways to work with partial functions (and reduce creation of closure and nested func for the developper).</div><div class=""><br data-mce-bogus="1" class=""></div><div class="">And now I am asking myself if it's not better to align operator's types to the arrow style instead of using tuple argument style.</div><div class=""><br data-mce-bogus="1" class=""></div><div class="">For example: </div><div class="">Why Int.multiplyWithOverflow's type is <span style="line-height: 1.5;" data-mce-style="line-height: 1.5;" class="">(Int, Int) -> (Int, overflow: Bool) instead of (Int -> Int) -> (Int, overflow: Bool)</span></div><div class=""><span style="line-height: 1.5;" data-mce-style="line-height: 1.5;" class=""><br data-mce-bogus="1" class=""></span></div><div class=""><span style="line-height: 1.5;" data-mce-style="line-height: 1.5;" class="">When curried function will come back (if it come back, which is a personal hope) that will avoid many refactoring.</span></div><div class=""><span style="line-height: 1.5;" data-mce-style="line-height: 1.5;" class=""><br data-mce-bogus="1" class=""></span></div><div class=""><span style="line-height: 1.5;" data-mce-style="line-height: 1.5;" class="">I think that, write this : </span>let f:(Int, Int) throws -> Int = (+) seem a bit ugly for this purpose <p class="p1"><span class="s1">let f:(Int -> Int) -> Int = (+) seem more suitable.</span></p><p class="p1"><span class="s1">We could imagine that in the future the compile could automatically create a closure if the programmer define something like </span></p><p class="p1">let lmul: (Int) -> (Int) -> (Int) = (*)</p><p class="p1"><span class="s1">and then, doing the habitual stuffs : let mulOfTwo = lmul(2)</span></p><div class=""><br class="webkit-block-placeholder"></div></div><div class=""></div><div class="">Kind regards,</div><div class="x-apple-signature"><pre style="font-family: 'SFNSText','Helvetica Neue', Helvetica, sans-serif; font-size: 15px; white-space: pre-wrap; word-wrap: break-word;" data-mce-style="font-family: 'SFNSText','Helvetica Neue', Helvetica, sans-serif; font-size: 15px; white-space: pre-wrap; word-wrap: break-word;" class="">--
jcnm</pre></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>