<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=""><div class="">I think this proposal: <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/003373.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/003373.html</a> would also solve this problem</div><div class=""><br class=""></div><div class="">as you’d be able to do .map(.0), and AFAICT it will still be unambiguous.</div><br class=""><div class="">
<div class="">— Radek</div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 18 Dec 2015, at 16:30, Alexandre Lopoukhine 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="">Hello everyone,<br class=""><br class="">To tie into the discussion of shorthands for “map", here’s something that I think is worth considering:<br class=""><br class="">Skipping the motivation (mostly, I’m on a mission to eliminate the $ character in my functional code), here’s a function definition:<br class=""><br class="">func first<A,B>(tuple: (A,B)) -> A {<br class=""> return tuple.0<br class="">}<br class=""><br class="">Having functions like this transforms<br class=""><br class="">pairArray.map({$0.0})<br class=""><br class="">into<br class=""><br class="">pairArray.map(first)<br class=""><br class="">This is not ideal, as it pollutes the global space, and there would need to be tons of those for various tuple sizes.<br class=""><br class="">Here’s an alternative:<br class=""><br class="">pairArray.map(().0)<br class=""><br class="">I think that this makes the intent pretty clear, as well as non-conflicting with anything in the language.<br class=""><br class="">What do you all think?<br class=""><br class="">— Sasha<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="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></body></html>