On Monday, 7 March 2016 at 07:58:53 UTC, Era Scarecrow wrote:
On Monday, 7 March 2016 at 06:57:48 UTC, Ola Fosheim Grøstad
wrote:
immutable π = 3.14;
Oh, the horror!
With the assumption pi is declared elsewhere (say, in
std.math), what i wonder is the number for pi vs 2 letters.
Unicode 03C0h, so now i have to convert that to decimal, code
960. Alt+960 = └
That's not pi... Looking up the symbol by itself in the
character map was annoying enough. No, this is not a good idea
unless it's easily accessible, preferably with 2 or fewer
keystrokes to symbolize pi.
But you can already use "π" in D code? D is inconsistent in what
parts of unicode you can use in names though. I don't think you
can use "∂"...
As a reminder most of us are programmers, not scientists or
mathematicians. Having specialized symbols won't give us any
benefit. It's not like we're filling out a complex formula with
college level math for a thesis.
Well, but you already have this possibility in D. Adding custom
operators is just a small extension. And you don't have to use it
if you don't want to.
There is no standard english notation for the inner product
either, "dot" refers to the sigil... But if you want both, you
can have both. You can both have "innerProduct(v1,v2)" and "(v1 •
v2)".
In a commercial setting you want as high level of legibility as
possible. D is doing slightly better than C++, but is far away
from providing a good legible syntax. More time is spent reading
code than writing it.
In some cases people want to use their own language. D supports
that. Math notation is no different than using a non-english
language in that regard. Why shouldn't mathematicians be allowed
to user the language they are familiar with if national languages
are supported?