<div dir="ltr">sqrt and pow may use different algorithms and provide slightly different numerical guarantees even if they're mathematically the same.<br><br>I agree cbrt is pretty marginal, I've never used that personally.<br><div><br>What is the difference between a standard library and an auxiliary library that is shipped with Swift? If both are shipped with Swift and both are documented in the user guide, it seems like a very minor distinction and I'm not sure what it buys us. Factoring the functions into appropriate libraries and then documenting any caveats seems sufficient to me, but maybe I'm missing something.<br><br></div><div>RE: Mike's query about stats functions. The functions aren't necessarily equivalent performance-wise or numerically in practice even if they are algebraically. E.g. sum(A) / size(A) isn't always a good way to compute avg(A) because of rounding and overflow concerns. I think there's a strong argument for providing solid, numerically sound implementations of common stats functions in Swift if they're likely to see usage.<br><br></div><div>Better support for reduces and loops would allow more to be implemented in Swift I think too.<br><br></div><div>- Tim<br></div><div><br><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 21, 2015 at 10:03 AM, Ketan Maheshwari <span dir="ltr"><<a href="mailto:ketan@mcs.anl.gov" target="_blank">ketan@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Jan 21, 2015 at 2:13 AM, Hategan-Marandiuc, Philip M. <span dir="ltr"><<a href="mailto:hategan@mcs.anl.gov" target="_blank">hategan@mcs.anl.gov</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><span class="">On Tue, 2015-01-20 at 21:59 -0600, Ketan Maheshwari wrote:<br></span><span class="">
> Neat!<br>
><br>
> Comments:<br>
><br>
> -- Statistical functions in a standard library seem out of place to me. One<br>
> may ask, why just stop with statistical functions and not also include<br>
> vector and matrix related functions such as cross and dot products or<br>
> fancier stuff like finding eigen values, etc.<br>
<br>
</span></span><span class="">They were in Swift/T and I thought they were useful. Dot products can be<br>
done with the zip() function. Cross products can be done with two nested<br>
foreach loops (although I did consider an outer join function). There<br>
are way too many ways to calculate eigenvalues efficiently, and there<br>
are also all kinds of weird algorithms to do so when you need only some<br>
eigenvalues, either the smallest or the largest. So I don't think we<br>
should get into that business.<br>
<br>
So I think the bottom line is that if there is something that is likely<br>
helpful for a lot of users and doesn't require a lot of work, then we<br>
should probably have it there.<br></span></blockquote><div><br></div><div>I understand the utility. My point was that may be we should move these functions out of standard library and put in another library, say auxiliary or something. As Mike mentioned in his reply, it would be nice if a canonical set of core functions are placed and locked in the standard library.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">
<span><br>
><br>
> -- sqrt and cbrt seem redundant as we already provide pow with float<br>
> exponent.<br>
<br>
</span></span><span class="">True. But it looks like most languages provide all of them anyway (I<br>
can't really think of a language that doesn't have sqrt). I guess it's<br>
just nicer to write sqrt(2) than of pow(2, 0.5).<br></span></blockquote><div><br></div><div>True for sqrt, not so much for cbrt though.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span><font color="#888888"><br>
Mihael<br>
</font></span><div><div class="h5"><div><div><br>
><br>
> Regards,<br>
> Ketan<br>
><br>
> On Tue, Jan 20, 2015 at 6:56 PM, Mihael Hategan <<a href="mailto:hategan@mcs.anl.gov" target="_blank">hategan@mcs.anl.gov</a>> wrote:<br>
><br>
> > Hi,<br>
> ><br>
> > I made a wiki page on github where we could discuss the standard<br>
> > library: <a href="https://github.com/swift-lang/swift-k/wiki/StandardLibrary" target="_blank">https://github.com/swift-lang/swift-k/wiki/StandardLibrary</a><br>
> ><br>
> > It's a draft and there are some rough edges. In particular:<br>
> ><br>
> > - regular expression support: substitutions can be done either directly<br>
> > or with a combination between a function that returns capture groups and<br>
> > a formatting function that replaces certain tokens with elements of an<br>
> > array. One could overload the format() function to, in addition to<br>
> > standard formatting specs, also support something like %s[index]. Or<br>
> > have a separate formatting function that only deals with this specific<br>
> > problem. I'm not sure.<br>
> ><br>
> > - some of the array functions may be difficult to implement as<br>
> > specified, or there may be different functions that solve the problems<br>
> > better. In particular when joining arrays of arrays, there is some<br>
> > freedom in how to order the elements of the resulting array.<br>
> ><br>
> > - read and write: it may not be easy to implement a read that can return<br>
> > any type in T. There is some precedent in other languages that support<br>
> > serialization for this.<br>
> ><br>
> > Anyway, I added red exclamation marks and red question marks where<br>
> > things aren't quite clear.<br>
> ><br>
> > I'm assuming that most of us will agree on most of the things. However,<br>
> > if you have a wildly different proposal, it might be wise to create<br>
> > another page instead of editing this one.<br>
> ><br>
> > Mihael<br>
> ><br>
> > _______________________________________________<br>
> > Swift-devel mailing list<br>
> > <a href="mailto:Swift-devel@ci.uchicago.edu" target="_blank">Swift-devel@ci.uchicago.edu</a><br>
> > <a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel</a><br>
> ><br>
<br>
<br>
</div></div></div></div></blockquote></div><br></div></div>
<br>_______________________________________________<br>
Swift-devel mailing list<br>
<a href="mailto:Swift-devel@ci.uchicago.edu">Swift-devel@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel</a><br>
<br></blockquote></div><br></div></div></div>