<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><span style="line-height:1.5">Currently, Swift doesn&#39;t have a way to easily pass a variadic parameter to another variadic function because the variadic parameter itself has already been collected into an array.</span><br></div><div dir="ltr"><br>There was a prior posting a few weeks back about allowing arrays to be passed to a variadic parameter which would resolve this very specific issue:<br><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160411/015185.html" target="_blank">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160411/015185.html</a><br><br>Unfortunately, that thread devolved into an argument on whether or not variadic parameters should be removed entirely.<br><br>I, certainly, see merit in having functions that can accept a variable number of arguments and variadic functions should seem intuitive to anyone else that might be reading the code.<br><br><div>Swift&#39;s documentation presents a very intuitive example:<br><ol style="border:0px;font-size:14px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;line-height:1.6em;list-style:none;font-family:helvetica,arial,sans-serif;background-image:initial;background-position:initial;background-repeat:initial"><li style="border-width:0px 0px 0px 18px;border-left-style:solid;border-left-color:transparent;margin:0px;outline:0px;padding:0px 10px 0px 0px;vertical-align:baseline;white-space:pre-wrap;list-style-type:none;background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial"><code style="border:0px;font-size:0.85em;margin:0px;outline:0px;padding:0px;vertical-align:baseline;font-family:menlo,monospace;word-wrap:break-word;background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial"><span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(63,110,116);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">arithmeticMean</span>(<span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(28,0,207);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">1</span>, <span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(28,0,207);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">2</span>, <span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(28,0,207);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">3</span>, <span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(28,0,207);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">4</span>, <span style="border:0px;font-size:11.9px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(28,0,207);background-image:initial;background-color:transparent;background-position:initial;background-repeat:initial">5</span>)</code></li></ol>It&#39;s obvious what this function is doing, and any intelligent person would expect 3 as the result.  Even WolframAlpha knows how to interpret this: <a href="http://www.wolframalpha.com/input/?i=arithmeticMean(1,+2,+3,+4,+5" target="_blank">http://www.wolframalpha.com/input/?i=arithmeticMean(1,+2,+3,+4,+5</a>) <br><br>Moreover, a function can only have ONE variadic parameter, which I think reduces any possible confusion.<br><br>Regardless, if variadic parameters are going to stay in Swift, then I think they should at least support chaining to another function.<br><br>The most obvious way of allowing this would be to allow variadic parameters to accept an array.<br><br>However, I think that if an array (of the parameter type) is specified for a variadic parameter, then no other values should be allowed.  This eliminates any unnecessary complexity of potentially having to add values to the array.</div><div><br></div><div>- Christopher Boyd</div></div></div></div>