<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="">Hi Oskar,<div class=""><br class=""></div><div class="">This is actually something we’ve spoken about in the core team meetings in the past as a known thing that ideally would work but doesn’t. The one that hits me a often is that I wish .forEach(print) worked, as it’s very useful as a quick debugging command.</div><div class=""><br class=""></div><div class="">I don’t know if we’re tracking it on <a href="http://bugs.swift.org" class="">bugs.swift.org</a> though, so it’d be good to see if you can find an SR for it there and if not, put your very clear explanation of the issue in a new SR.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Ben</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 17, 2017, at 5:14 PM, Oskar Ek 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="">Hello Swift evolution community!<div class=""><br class=""></div><div class="">Developing in Swift, I have many times found myself being frustrated that a function with default parameters can’t be passed to another function.</div><div class=""><br class=""></div><div class="">For example:</div><div class=""><br class=""></div><div class="">// sorts a string alphabetically</div><div class="">func sort(string: String, descending: Bool = false) -&gt; String {</div><div class="">&nbsp; return String(string.sorted { descending ? $1 &lt; $0 : $0 &lt; $1 })</div><div class="">}</div><div class=""><br class=""></div><div class="">let strings = [”swift", ”apple”, ”ios”]</div><div class=""><br class=""></div><div class="">If I wanted to map over the strings and sort each one, I would expect this to work:</div><div class=""><br class=""></div><div class="">strings.map(sort(string:)) // expected output: [”fistw", ”aelpp”, ”ios”]</div><div class=""><br class=""></div><div class="">However, this produces the&nbsp;error: <i class="">use of unresolved identifier 'sort(string:)’</i></div><div class=""><br class=""></div><div class="">Instead, I have to write:</div><div class=""><br class=""></div><div class="">strings.map { sort(string: $0) }</div><div class=""><br class=""></div><div class="">Anybody else that would appreciate this possibility?</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>