<div dir="ltr">I don’t think we should be designing interfaces based off of what pure mathematicians write. Scientists aren’t the only people who use sin(x). It’s better to go with the “common sense” behavior than the esoteric academic notation. And for the record, I think Matrix.map(sin(_:)) is the best and most clear interface for elementwise sin.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 3, 2017 at 7:00 AM, Stephen Canon via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><span class=""><div><blockquote type="cite"><div>On Aug 2, 2017, at 6:37 PM, Nicolas Fezans via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_1138132244635487186Apple-interchange-newline"><div><span style="font-family:Helvetica;font-size:12.800000190734863px;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;float:none;display:inline!important">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 &#39;sin&#39; looks quite ugly for scientists).</span></div></blockquote></div><div><br></div></span><div>You’re on very shaky ground here. It is not at all obvious that sin(A) should be the “elementwise” sine that you suggest, and not the matrix sine (defined by plugging A into the power series for sine, which is globally convergent). Depending on what branch of science/math you come from, one of these is “obviously” the right answer, but I assure you that it’s very much not obvious.</div><div><br></div><div>Yes, we want libraries to build this sort of thing to exist.</div><div><br></div><div>No, it’s not clear what the “right” way to expose some of these operations in the language/library are.</div><div><br></div><div>It is better to be verbose but correct than to be terse and cause bugs.</div><div><br></div><div>– Steve</div></div><br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div>