<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On 3. Aug 2017, at 00:43, Xiaodi Wu 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 style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div dir="auto" class=""><br class="Apple-interchange-newline">On Wed, Aug 2, 2017 at 17:37 Nicolas Fezans &lt;<a href="mailto:nicolas.fezans@gmail.com" class="">nicolas.fezans@gmail.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class=""><div class="">I think that the items mentioned earlier in the list (just reminded below) should not all be treated equally.<br class=""></div><div class=""><br class=""></div><div class=""><div style="font-size: 12.800000190734863px;" class=""><div class=""><div class=""><div class=""></div></div></div></div></div></div><div class=""><div class=""><div style="font-size: 12.800000190734863px;" class=""><div class=""><div class=""><div class=""><div class="">- RNG and cryptography library (CryptoSwift could be a good base for this)<br class=""></div>- Generic Math library/Vector library<br class=""></div></div></div></div></div></div><div class=""><div class=""><div style="font-size: 12.800000190734863px;" class=""><div class=""><div class="">- Basic data structures (Tree, Balanced Tree, Heap, Queue, SkipList, graphs, etc)<br class=""></div></div></div></div></div><div class=""><div class=""><div style="font-size: 12.800000190734863px;" class=""><div class=""><div class=""></div>- Modern DateTime library<br class=""></div></div></div></div><div class=""><div class=""><div style="font-size: 12.800000190734863px;" class=""><div class="">- Modern String processing toolkit<br class=""></div>- 2D Graphics library (similar to cairo)<br class=""></div></div></div><div class=""><div class=""><div style="font-size: 12.800000190734863px;" class=""></div><span style="font-size: 12.800000190734863px;" class="">- Windowing/UI library</span><br class=""></div><div class=""><span style="font-size: 12.800000190734863px;" class=""><br class=""></span></div><div class=""><span style="font-size: 12.800000190734863px;" class="">By that I mean that I see at least one distinction to make between:</span></div><div class=""><span style="font-size: 12.800000190734863px;" class=""><br class=""></span></div><div class=""><span style="font-size: 12.800000190734863px;" class="">a) the libraries that would make Swift and the programmer experience with these libraries under Swift significantly better if they are (or at least feel) deeply integrated in the language (for instance with associated&nbsp;</span><span style="font-size: 12.800000190734863px;" class="">syntax /&nbsp;</span><span style="font-size: 12.800000190734863px;" class="">syntax sugar)</span></div><div class=""><span style="font-size: 12.800000190734863px;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>and&nbsp;</span></div><div class=""><span style="font-size: 12.800000190734863px;" class="">b) those that would not really benefit from such an integration to the language.</span></div><div class=""><span style="font-size: 12.800000190734863px;" class=""><br class=""></span></div><div class=""><span style="font-size: 12.800000190734863px;" class="">For me a core math library, clearly belongs to category a)</span></div><div class=""><span style="font-size: 12.800000190734863px;" class="">I am of course not talking about a syntax sugar to call a sin or cos function, but rather to manipulate other objects such as N-dimensional matrices, defining maths functions that can take such matrices as argument e.g. sin(A) with A as matrix produces a matrix of the same size where all elements are the sinus values of the elements of A (sorry but things like this calling map() with 'sin' looks quite ugly for scientists).</span></div><div class=""><span style="font-size: 12.800000190734863px;" class="">Such a good math syntax should be compact enough to have complete equations looking "close enough" to the maths equations you could have written in a LaTeX or Word documentation of your scientific code. IMO a well integrated swift core math library should feel a Julia or Matlab code (while still having the power of Swift in terms of speed and modern programming paradigms) instead of looking and feeling like 'numpy'. But the latter is what you get if you just make a math library with no integration to the language syntax, operators, and basic functions.</span></div><div class=""><span style="font-size: 12.800000190734863px;" class=""></span></div></div></blockquote><div dir="auto" class=""><br class=""></div><div dir="auto" class="">I agree that if this would require compiler support, then it needs to be part of the standard library. However, I don't see anything about what you describe that cannot be supported as a third-party library.</div></div></div></div></blockquote><br class=""></div><div>It’s important to remember that computers are mathematical machines, and some functions which are implemented in hardware on essentially every platform (like sin/cos/etc) are definitely best implemented as compiler intrinsics.</div><br class=""><div class="">That said, I don’t think N-dimensional matrices need to be part of the standard library. I still think there’s plenty of space for good library implementations. We can’t realistically expect anybody to implement a (fast) cosine function from scratch, though.</div><div class=""><br class=""></div><div class="">I think Swift should allow you to write a standard scientific calculator without downloading a mathematics library. Essentially, that means basic trig, exponentiation and logarithms. Possibly even factorials.</div><div class=""><br class=""></div><div class="">- Karl</div><div class=""><br class=""></div></body></html>