<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="">map and dictionary syntax would not go together. &nbsp;map (or any function that takes a block of code) takes a block of functional code that applies that function to all elements of a collection (potentially value/optional) . &nbsp; The map idea was to extend this to allow pattern matching through { caseClauses } [also known as unary functions in another language].<div class=""><br class=""></div><div class="">{ caseClauses } expands to { caseClause [in :] ….. caseClause&nbsp;[in :] ….. etc. }</div><div class=""><div class=""><br class=""></div><div class="">The multi-case ternary idea is a very very specialized case — and to me it looks like it would only allow things like a c/enum type switch returning values?</div><div class=""><br class=""></div><div class="">Whereas expanding map to allow caseClauses would allow for more functionality, things like returning functions based on pattern matching which would then be used later for other calculations etc. — as well as giving the simple functionality of a switch expression.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> interestCalculationA(balance: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span>) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> mockValue = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1.00</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> mockValue</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> interestCalculationB(balance: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span>) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span> {</div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> mockValue = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2.00</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> mockValue</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> interestCalc : <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span> -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">products</span>.map {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(187, 44, 162);" class="">case</span> .LiquidProduct:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; interestCalculationA</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">case</span> .TermProduct:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; interestCalculationB</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(187, 44, 162);" class="">case</span>&nbsp;.ThirdProduct:</div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;interestCalculationB</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> interest = <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">interestCalc</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">map</span> {x <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">in</span> x(<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">100.00</span>)}</div></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 2016-01-10, at 8:58:42, Charles Constant 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 dir="ltr" class=""><div class=""><br class=""></div><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span>let&nbsp;num =&nbsp;color.</b><b style="font-size:13px;font-family:Arial" class=""><font color="#008cb4" class="">map&nbsp;</font>{</b><br style="font-size:13px" class=""><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;font-family:Arial" class=""><font color="#4f7a28" class="">.Red:</font></b><b style="font-size:13px;font-family:Arial;color:rgb(227,36,0)" class="">&nbsp;</b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">100,</b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">&nbsp;</b><br style="font-size:13px" class=""><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;font-family:Arial" class=""><span style="white-space:pre-wrap" class=""><font color="#606060" class="">        </font><font color="#4f7a28" class="">.</font></span></b><b style="font-size:13px;font-family:Arial" class=""><font color="#4f7a28" class="">Green:&nbsp;</font></b><span style="font-size:13px" class="">&nbsp;</span><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">200</b><b style="font-size:13px;font-family:Arial" class=""><font color="#e32400" class="">,</font></b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">&nbsp;</b><br style="font-size:13px" class=""><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;font-family:Arial" class=""><font color="#4f7a28" class="">.Blue</font><font color="#e32400" class="">:&nbsp;</font></b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">300</b><b style="font-size:13px;font-family:Arial" class=""><font color="#e32400" class="">,</font></b><br style="font-size:13px" class=""><div style="word-wrap:break-word" class=""><div dir="ltr" class=""><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><b style="color:rgb(96,96,96)" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="color:rgb(96,96,96)" class=""><span style="white-space:pre-wrap" class="">        </span></b><b class=""><font color="#4f7a28" class="">_</font></b><b style="color:rgb(227,36,0)" class="">&nbsp;:&nbsp;</b><b style="color:rgb(96,96,96)" class="">-1</b><b style="color:rgb(227,36,0)" class="">&nbsp;</b></div><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><b class=""><span style="color:rgb(227,36,0);white-space:pre-wrap" class="">        </span>}</b></div><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><b class=""><br class=""></b></div><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><b class=""><br class=""></b></div><div style="margin:0px;line-height:normal" class="">Looks like I forgot to mention what my previous message regards: I mean that if we go with "map", I prefer the version that doesn't require "case" be written.<br class=""></div><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><span style="font-family:arial,sans-serif" class=""><br class=""></span></div><div style="margin:0px;line-height:normal" class="">I also realize whether we're verbose&nbsp;enough depends on how commonly people use this type of expression. If it is accepted, but unpopular, then I'd concede "verbose" makes more sense.&nbsp;</div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">Anyways, I'll try to lurk for a while now, instead of posting, as I'm veering toward the bike-shed :)</div><div style="margin:0px;line-height:normal" class=""><br class=""></div></div></div><div class="gmail_extra"><br class=""></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=CGU22LnxbYa2EM3wKvzuC6syQDwKa0tMs5IyT5gL1wLFCRtEWLAM520-2BLvZMt-2Ff4xh1-2BXOhLWKyzasfJ7eXY-2F6xkN954szJKS9N4YbakBCRRaCtmkej75oDZq1K-2FtlQ9Zrnyz9wpgOeduRiHI8AcKtWptLEFxEdFj0fjGmXZH7P24YFUsJxYhapGKyj9rKrgkYT5BRRJvdebLrfFQploUwxLaTdZQZlB2JP-2BXG06Pcc-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" 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></blockquote></div><br class=""></div></div></body></html>